Git cheatsheet
Git is a distributed version control system that allows developers to collaborate on large or small projects.
This cheat sheet helps familiarise you with fundamental git commands.
Setting Git username:
git config --global user.name "Manideep"Setting Git user email:
git config --global user.email "example@gmail.com"Initialize Git repo :
git initAdding file to staging area:
Single file
git add file_nameAll files
git add .Status of Git repository :
This will show you current repository status:
- Staged
- Unstaged
- Untracked files
git status
Commit changes:
git commit -m "Your message"Commit history in Git :
git logRemove tracked files current working tree in Git :
git rm filenameIgnore files in Git :
Create a
.gitignorefile, add the file names you want to ignore, and commit it.Creating a new branch in Git :
git branch branch_nameSwitch branch :
git checkout branch_nameList of branches :
git branchCreate a new branch and switch to it :
git checkout -b branch_nameDelete a branch :
git branch -d branch_nameMerge branch with current branch :
git merge branch_nameAdd a remote repository :
git add remote repoURLList of remote URL :
git remote -vPush your changes to remote repository :
git pushPull changes from remote repository :
git pull
These commands will assist you in getting started with Git.
This is all from my side. Thanks for reading.




