Note: Git commands

This is just a simple reference note for Git commands I use often but tend to forget. It’s meant to be an evergreen document and will be updated as necessary.

Branches

Create a new branch
git branch <BRANCH_NAME>

Switch to a branch git checkout <BRANCH_NAME> or
git switch <BRANCH_NAME>

Creat a new branch and switch to it in one go
git checkout -b <BRANCH_NAME>

Remote repositories

List remote repositories
git remote -v

Change remote repository URL
git remote set-url origin <NEW_URL>

Configuration

List current configurations
git config -l

Other

Omit files from being checked for changes
git update-index --assume-unchanged <PATH_TO_FILE>

Undo the above
git update-index --no-assume-unchanged <PATH_TO_FILE>

List files marked with --assume-unchanged
git ls-files -v