- Install Git
- Destination location: default is fine
- Components: defaults are fine
- Default editor: "Use VisualStudioCode as Git's default editor"
- Start Menu Folder: default is fine
- Adjusting your PATH: "Use Git from the Windows Command Prompt" recommended
- HTTPS - SSL/TLS library: "Use the OpenSSL library" recommended
- Line-ending conversions: "Checkout as-is, commit as-is"
- Terminal emulator for Git Bash: "Use Windows' default console window" recommended
- Extra options: recommended to select all
- Enable file system caching
- Enable Git Credential Manager
- Enable symbolic links
- Generate an SSH key
- Configure Git
git config --global user.name <your name>
git config --global user.email <your email>
- Use the same e-mail address associated with your GitHub account
git config --global gui.encoding utf-8
git config --global core.autocrlf false
git config --global core.ignorecase false
git config --global core.safecrlf false
git config --global pull.rebase true
git config --global branch.autosetuprebase always
- GUIs (optional)
- (Windows) TortoiseGit
- (Windows) Git Extensions
- (Mac, Windows) Sourcetree
Git comes with a GUI in addition to the CLI. In Windows, you should be able to right-click a folder and choose "Git GUI Here" from the context menu to open it. In any OS, you can type git gui
from the command line.
You can configure the tab size in Git Gui:
git config --global gui.tabsize 4
VS Code has built-in support for Git that is very useful.
⛔ NEVER click the "Synchronize Changes" icon at the left of VS Code's bottom status bar. This will sometimes create completely unnecessary merge commits.
Git stores the history of your code and simplifies collaboration, experimentation, and ensuring that you always have a stable copy of your code.
- History: when you edit files, Git notices they have changed. It does not automatically track every change. When you have made a set of changes that you want Git to track, you commit those changes. Git's history is a tree of commits.
- Branches: a new repository starts with a default branch named "master". We want to ensure master has completed, tested code, so if you start work on a new feature you create a new branch. When you create a new branch you get a copy of everything in master at the time you create the branch. Changes can continue happening in master while you make changes in your branch, but you will not automatically get those changes. When work in your branch is completed and tested it will be incorporated into master.
- Rebasing: rebasing is the cleanest way of copying changes from one branch to another. When you create a new branch from master and need to copy new updates from master to your branch, you will rebase.
- Git book (chapters 1-3, 5, 6-8)
- Feature branch workflow
- Rebasing
- Rebase workflow