Handy Git Commands for Beginners
A growing cheat sheet of the more handy Git commands used by engineers and the like. Nothing fancy.
Setting up your Git environment
The easiest way to install Git in a Windows environment is to download and install Git for Windows. It includes its own Git shell without having to install WSL or create a Linux VM, a GUI application, and shell integration.
If Mac OS is your environment, use the Git for Mac Installer. Apple maintains its own fork as well, and is included when you install XCode.
Optionally, if your projects and repositories are on GitHub, it's recommended to install GitHub Desktop.
Check your environment
Confirm your Git installation:
git --version
Verify your Git configuration (while in the root directory of a local repository)
git config --list
Before making your first commit...
... on your machine for the first time, you'll need to set your default user.name and user.email.
For a project-specific name and e-mail, run this from the root of your local copy of the repository:
git config user.name "FirstName LastName"
git config user.email email@company.tld
To set it globally, just add the --global parameter, like so:
git config --global user.name "FirstName LastName"
git config --global user.email email@company.tld
No comments