[@naukriengineering] git basic commands and hacks

Post on 21-Jan-2017

103 Views

Category:

Engineering

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

GIT commands

Rashi Atry

(Naukri Quality)

WHAT IS GIT?

How do You use Git?

via Tools/ extensions OR command line?

Basic Commands

git clone <.git url>

git checkout

git status

git branch

git add

git pull

git commit

git push

git stash

git checkout

git checkout

git checkout <branchName>

git checkout –b <newBranchName>

git checkout <fileName>

git add

git add

git add –p

git add –p <fileName>

git stash

git stash

git stash save

git stash list

git stash apply

git stash drop

git stash -p

git reset

git reset - -hard HEAD

git reset - - soft <any point hash>

More Commands

git commit –m <commitMessage>

git branch –m <newBranchName>

git push origin <nameOfBranch>

Git Shortcuts

git alias

git config --global alias.ci commit

git config --global alias.co checkout

git config --global alias.br branch

git config --global alias.st status

Tip and Tricks

Pull frequently

Commit early and often

Make logical commit messages

Write understandable commit messages

Push when your changes are tested

Branch freely

Merge carefully

Stash before switching branches

Stash with meaningful messages

Thank you

top related