(This directory will stay the same except this specific file)
i had this problem when i pulled from the other pc. It was like the
name of the remote branch was main while the name of the local
was master and created some problem. The history of the commands
i used:
git push origin --delete master
git branch -dr origin/master
git log --oneline --all
cat ../key
git diff
git diff master origin/master
git diff HEAD..REMOTE_HEAD
git diff HEAD .. REMOTE_HEAD
git log --oneline --all
git push origin/main
git push
git log --oneline --all
git push --set-upstream origin master
git log --oneline --all
git push origin --delete master -> Delete the remote branch
git log --all --oneline
git branch -m main
This is a test repository to exercise the workflow (i have the description of
some of the git commands so as to remember )
Basic git commands:
git init (initialize, that is create the .git in the local directory)
add . (add all the files contained in the local directory )
log --graph (display a story of commits with a small graph)
diff (display the difference between the current state of the folder and the latest commit)
diff --cached (show the differences between the files before using the add command )
commit (create a time stamp of the files at the state it were after the add)
git clone http..(it makes a copy of a remote file )
git remote add origin http... (Like a shortcut in order to operate commands as it was reffered
to a local folder. When you clone a dir there is no need to do
that )
git restore --source= -- . (restore the folder in a previous state defined by the commit)
(the folder changes but commits stay as they are)
-> HEAD~5 : That means 5 commits back from HEAD (it is not a command, just mentioning it)
git revert (Safe for shared commits since it does not delete any commits )
git rebase -i (-i means interactive. You can edit the commits, that is change description or d
elete) leave the first and squash (s) all the others. If you want to change
the description of a commit replace with . After that
write git rebase --continue
git commit --amend (Change the last commit message)
reset --hard (Goes to the commit mentioned by and deletes all
other commits after it )
git cat-file -t (Show what kind of thing is the object described by )
git cat-file [commit|tree|blob|tag] (show the file decripted)
git ls-tree (show the tree decripted )