git pull && git submodule update --init
git pull origin <branch> --rebase
git remote show origin
Throw away all my staged and unstaged changes, forget everything on my current local branch and make it exactly the same as origin/master
:
git reset --hard origin/master
git push origin master
See the header message "user wants to merge x commits into master from branch_name":
git checkout <branch_name>
git checkout -b <my_branch_name>
git checkout @ -- <file>
git reset HEAD -- <file_or_directory>
git reset HEAD^
git reset --hard
git reset --hard origin/master
git stash save --keep-index --include-untracked
Only for one file:
git diff <my_branch> master -- <file>
For all files:
git diff --stat --color master..my_branch
git checkout <branch_name> -- <file>
git log --full-history -- "<path/file>"
Add --all
to search in all branches.
Add filenames in file:
.git/info/exclude
git merge <branch>
Note: check the button Update branch at the end of the PR at github to do easily.
git config --global --edit
-> set autocrlf = false
git ls-files --eol
In the output, i/lf
means that the file uses lf (UNIX format) in the index, and w/crlf
(Windows format) means it uses crlf in the working directory.