GIT COMMAND CHEAT SHEET - muneeb-mbytes/linux_course GitHub Wiki

GIT COMMAND LIST

git command Description
git init directory_name Create a new repository
git clone paste_the_repository_link To copy the Repository to the server/local
git add file_name Used to add the files to staged area
git add . Add the all files in the project/repository to staged area (.) is a wildcard
git add fil* Add all the files to the staged area the file starting with fil*. (*) is a wildcard
git status get the status of current repository whether it is in modified (untracked files),staged and commit status
git commit –m “add commit summary” It will used to create a commit ID's for each changes made in the file
git log Display the commit history (ID’s) on the terminal
git log -p Display the commit history along with the File line changes  in the each commit
git log --stat Display the commit ID’s, Display the file changes and number of lines inserted/deleted to the file
git mv old_file new_file Used to move the content in the old file to new file
git checkout branch Used to shifting between the branches
git branch branch name It create a new branch in the Repository
git checkout –b branch_name It also used to create the new branch but it will point (*) to the newly created branch
git branch Display the branches along with it mark the asterisk (*)shows that we are in which branch
git branch –d branch_name It will delete the branch from local
git merge --abort It is used to get-out from the merging
git merge It will merge the branch to the current branch
git push origin branch_name After the commit changes we can push the content to github.
git pull We can get the updated details of other Repository to the server/local
git fetch Fetches a specific branch, from the repository Leave off to fetch all remote reference/branches.
git branch -all To git all branches of repository
git push origin --delete branch_name It will remove branch from server.