Git Commands Summary
Git Commands Summary
Version Control
• First run git init for Project in terminal to Initialize your Repo
• If files with green color that’s mean the files added Successfully
• Confirm changes by git commit -m “message”
• Display all Tracked Files in Staging Area git ls-files
• display all commits of repo
git log
git log –oneline for shot brief
• When you create new branch in local you need to make opposite branch In
remote to make operations on it like pull / push
Git push -u remoteName BranchName
Git push -u origin feature
Will create feature branch in (origin / remote) repo then sync with feature
branch in local repo
• Pull = Fetch + merge in one command
Git pull remoteRepo you will fetch from
Git pull origin
• Display list commit in different branches
Git branch -v
• Display tracked branches
Git branch -vv
Terms :
Git: version control
GitHub: hosting service for git
Branch : Linear Order of Commits
Tag : make specific Commit special
Fork: make a Copy form GitHub Repo to your GitHub Account
Clone : it to download repo without close the connection to this repo
Push : upload your changes to cloned repo
Pull : fetch new changes from remote repo to cloned / local repo
SSH authentication :
You can access and write data in repositories on GitHub.com using SSH (Secure
Shell Protocol). When you connect via SSH, you authenticate using a private
key file on your local machine.
Contribute Workflow:
1- Fork Repo
2- Clone Repo to you local. [add remote from GitHub Repo to you Local]
3- Add new remote to local Repo this remote must be the Author Repo you
take Fork from him