Git configuration
git config --global user.name "Your Name"
git config --global user.email "Your Email"
Starting a project
git init [project name]
git clone [project url]
Remove file from directory
git rm [file name]
Status of working directory
git status
Add a file to the staging area
git add [file name]
Discard changes in working directory
git checkout --[file name]
Commit to local
git commit
Revert your repository
git reset [file name]
List all local branches
git branch [-a]
Fetch changes from the remote and merge current branch with its upstream
git pull [remote]
Join specified from name branches
git merge [from name]
Create new branch
git branch [branch name]
Push local changes to the remote
git push [--tags] [remote]
Remove selected branch
git branch -d [branch name]
Fetch changes from the remote
git fetch [remote]
Switch current branch to specified branch
git checkout [-b] [branch name]
Git cheat sheet image
All the best to you.
Top comments (1)
I would replace the
checkout
commands with more modern alternatives. E.g.git switch <branch>
. Learn more here.