Git
Fron elijahmanor.com
New user
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
Conflicts with end of file
It's cause of Windows end of file (CRLF) conflict with Linux end of file (LF), just update global git core
git config --global core.autocrlf false
And re-clone repository
“Pulling without specifying...”
“Pulling without specifying how to reconcile divergent branches is discouraged”
git config --global pull.ff only
Change default editor
Example to change to vim editor
git config --global core.editor "vim"
Erase a branch with another
Erase a branch with another
git checkout branch_to_erasegit reset --hard branch_to_keep
Delete branch
# localgit branch -d branch_to_delete# on origin remotegit push origin --delete branch_to_delete
Commit changes on other branch
git stashgit checkout other_branchgit stash pop
Unstage all files
git reset
Add files and commit
git commit -am
Pull to overwrite local files
Source : stackoverflow.com
git fetch --all
Take master branch to overwrite local
git reset --hard origin/master
With another branch
git reset --hard origin/branch_name