Git Cheatsheet for Beginners
Git
It is a version control system, which is a tool used to manage changes to code, programs, documents and other information stored as computer files.
GitHub
It is a hosting platform that allows developers to create, store, and manage their code. On Github you can upload your code to a public or private space on the internet.
Git Cheatsheet
Here are some of the most common commands you'll need to know:
For Config
1git config --global user.name "Your Name"
2git config --global user.email "[email protected]"
To View Username, Email and Other Details
1git config --list
To Get Help
1git help
Initialize a Repository
1git init
To Add File or Files To Staging Area
1git add filename
2git add .
To Commit Change
1git commit -m 'Short and Sweet Message'
Clone Existing Repository
1git clone <project_url>
Checking the Status Files
1git status
View Difference
1git diff
To Remove File From git
1 git rm filename
To Move File
1 git mv file_from file_to
To View Commit History
1git log
To Work With Remote Repository
1git remote show origin
2git remote -v
3git remote add origin
4git push origin <branchname>
5git pull
To Create Branch
1git branch <branchname>
To Switch Branch
1git checkout <branchname>
To Merge Branch
1git merge <branchname>
To Delete Branch
1git branch -d <branchname>
To Create Tag
1git tag <tagname>
To Push Tag
1git push origin <tagname>
To Delete Tag
1git tag -d <tagname>
To Push All Tags
1git push origin --tags
To Delete Remote Tag
1git push origin :refs/tags/<tagname>