Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 5

Git Fundamentals

Getting started
 Git config (global/local)
 .. [name/email/editor + other preferences]
 Git init
 Git clone repoUrl emptyDirectory
 Git clone repoUrl
 .gitignore // Ignoring things from VCS
Adding & Commiting
 Git diff
 Git add . //adding changes to staging
 Git add fileName
 Git status
 Git commit [-m msg] [-a //all]
 Git commit –amend //adding stuff to prev commit
 Git log –[one-line,n,author..]
 Git tag [annotated/lightweight]
 Git revert commitID/HEAD
 Git reset [options]
 Git stash
 Git stash pop/apply/list/drop/..
 Git stash branch branchName
Branching, merge & Rebase
 Git branch branchName // create branch
 Git checkout branchName //move to branch
 Git checkout -b branchName //create n checkout
 Git rebase base[commitID/branchName/HEAD]
 Git branch -d branchName //delete branch
 Git branch -m branchName //rename current branch
 Git merge branchName // merge two branches
 Git rebase -i // interactive rebasing [squash]
Remote stuff
 Git remote add remoteName repoURL.git
 Git remote -v //show remote repo URL
 Git pull repoURL.git
 Git fetch repoURL.git
 Git push remoteName branchName
 Git mergetool //for resolving merge conflicts

You might also like