26
Nov
2020

Useful Git Commands

List of useful Git commands

Configure local git repo

git config --local user.email "EMAIL"
git config --local user.name "USERNAME"

Configure global git

git config --global user.email "EMAIL"
git config --global user.name "USERNAME"

Checkout a new branch with uncommitted changes.

git checkout -b NEW_BRANCH

Checkout a new branch with uncommitted changes with Git 2.23+

git switch -c NEW_BRANCH

Amend the last commit

git commit --amend

Or with a commit message

git commit --amend -m "New commit message"

Remove files or folders from git repo

git rm -r --cached FILE_OR_FOLDER
Share

You may also like...