Set up Git
Last updated:
Install Git
Section titled “Install Git”Download Git from git-scm.com/install and run the installer. Git for Windows includes Git Bash: use that terminal for every command here. If your editor has Git built in, it runs the same commands under its interface.
git --versionTell Git who you are
Section titled “Tell Git who you are”Git records this identity on every commit you make.
git config --global user.name "Alex Example"git config --global user.email "alex@example.com"Three defaults
Section titled “Three defaults”git config --global init.defaultBranch mainThis names the first branch of a new repository main instead of master.
git config --global pull.rebase trueWithout this, pulling your own branch after pushing from two machines creates a commit titled something like “Merge branch ‘add-login’ of codebahn.net into add-login”. Rebasing on pull avoids it.
git config --global push.autoSetupRemote trueWith this set, git push works on a new branch without typing -u origin <branch> first.
git config --global --listWhat’s next
Section titled “What’s next”The daily loopClone, see what changed, commit, share, update.
Git basics is licensed under CC BY 4.0: copy it, adapt it, keep the credit.

