Git
Git is a distributed version control system that tracks versions of files. It is often used to control source code by programmers collaboratively developing software.
Installation
sh
sudo apt install -y gitConfiguration
sh
git config --global user.email "you@example.com"sh
git config --global user.name "Your Name"Actions
Erase a branch with another
Erase a branch with another
sh
git checkout branch_to_erase
git reset --hard branch_to_keepDelete branch
sh
# local
git branch -d branch_to_delete
# on origin remote
git push origin --delete branch_to_deleteCommit changes on other branch
sh
git stash
git checkout other_branch
git stash popUnstage all files
sh
git resetAdd files and commit
sh
git commit -amPull to overwrite local files
Source : stackoverflow.com
sh
git fetch --allTake master branch to overwrite local
sh
git reset --hard origin/masterWith another branch
sh
git reset --hard origin/branch_nameTroubles
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
sh
git config --global core.autocrlf falseAnd re-clone repository
“Pulling without specifying...”
“Pulling without specifying how to reconcile divergent branches is discouraged”
sh
git config --global pull.ff onlyChange default editor
Example to change to vim editor
sh
git config --global core.editor "vim"Cheatsheet

From elijahmanor.com