GIT -CheatSheet

Photo by Brina Blum on Unsplash

GIT -CheatSheet

GIT a version control system-Git is used to tracking changes in the source code-Git is the distributed version control tool is used for source code management.

Create New Repositories

🏴 Creates a new local repository

$ git init

Make Local Changes

🏴Add all current changes to the next commit

$ git add

🏴Changes the last commit done

$ git commit

🏴Changed files in your working directory

$ git status

Commit History

🏴Shows all commits,starting with newest

$ git log

Branches and Tags

🏴Lists all existing branches

$ git branch -av

🏴Will Switch Head branch

$ git checkout < branch >

Update and Publish

🏴Show unformation about a remote

$ git remote show< remote >

🏴 Download changes and directly merge/integrate into HEAD

$ git pull < remote > < branch >

🏴Publish local changes on a remote

$ git push < remote> < branch >

🏴Publish your tags

$ git push --tags

Merge and Rebase

🏴Merge < branch > into your current HEAD

$ git merge < branch >

🏴Rebase your current HEAD onto < branch>

$ git rebase < branch >

🏴Abort a rebase

$ git rebase --abort

Undo

🏴Discard all local changes in your working directory

$ git reset < commit >

🏴Preserve uncommitted local changes

$ git reset --keep < commit >