Anda di halaman 1dari 2

Git Commands

http://gitref.org/ http://progit.org/book/

Configuration
git config --global user.name "John Doe" git config --global user.email johndoe@example.com

Getting Help
git help <verb> git <verb> --help man git-<verb>

Getting a Git Repository


Initializing a Repository in an Existing Directory
git init

Start tracking files


git git git git add *.c add . add README commit -m 'initial project version'

Cloning an Existing Repository


git clone git://github.com/schacon/grit.git git clone git://github.com/schacon/grit.git mygrit

Recording Changes to the Repository


http://progit.org/book/ch2-2.html git git git git git git git status log log --pretty=oneline diff commit commit -am 'reason for commit' commit --amend

Branching
List branches
git branch With last commit info: git branch -v

Creating a new branch


git checkout -b hotfix Short for: git branch hotfix git checkout hotfix

Merging
git checkout master git merge hotfix Show merged branches: git branch merged Show branches yet to be merged: git branch --no-merged

Delete a branch
git branch -d hotfix

Rebasing
???

Working with Remotes


Listing remotes
git remotes git remote show origin

Listing remotes with URL


git remote -v

Pushing to remotes
git push origin master