====== Setup ====== ===== Common ===== # configure the user which will be used by git # Of course you should use your name git config --global user.name "Example Surname" # Same for the email address git config --global user.email "your.email@gmail.com" # set default so that all changes are always pushed to the repository git config --global push.default nothing # colors git config --global color.ui true git config --global color.status auto git config --global color.branch auto # set editor git config --global core.editor vim # add aliases git config --global alias.ci commit git config --global alias.co checkout # Reset any local and staged changes as if nothing happened git config --global alias.nah "!git reset --hard && git clean -df" # Add more changes to the latest commit without editing commit message git config --global alias.amend "commit --amend --no-edit" ===== For Linux ===== git config --global core.autocrlf input git config --global core.safecrlf true ===== For Windows ===== git config --global core.autocrlf true git config --global core.safecrlf true ===== Useful bash aliases ===== alias gfo='git fetch origin && git status' alias gitlog='git log --graph --oneline --decorate --all --color=never' alias gpull='git pull origin $(git rev-parse --abbrev-ref HEAD)' alias gpush='git push origin $(git rev-parse --abbrev-ref HEAD)' alias gst='git status' ====== Links ====== * [[https://medium.freecodecamp.org/how-to-become-a-git-expert-e7c38bf54826|How to become a Git expert]] - about amend and rebase * [[https://ochronus.com/git-tips-from-the-trenches/|Git tips from the trenches]] * [[https://www.atlassian.com/git/tutorials|Atlassian Git tutorials]] * [[https://lornajane.net/posts/2014/understanding-tracking-branches-in-git|Understanding Tracking Branches in Git]] * [[https://dev.to/citizen428/10-common-git-problems-and-how-to-fix-them-234o|10 Common Git Problems and How to Fix Them]] * [[https://opensource.com/article/20/10/advanced-git-tips|7 Git tricks that changed my life]] * [[https://opensource.com/article/20/10/git-config|Tweak your Git config for multiple user IDs]] * [[https://medium.com/swlh/effectively-handling-multiple-git-accounts-on-a-single-machine-8e4ddf878c59|Effectively Handling Multiple Git Accounts on a Single Machine]]