Git for Subversion users

Updated . Posted . Visible to the public.

This is for people recovering from Subversion.

Get an existing from the server for the first time

git clone git@example.com:repositoryname

See what's changed

git status

Check in locally

git commit -m "good description"

Push local commits to the server

git push

Get and merge updates from the server

git pull

Stage a file for the next local commit

git add file

Stage all files for the next local commit

git add .

Create a new local branch and check it out

git checkout -b branchname

Switch to a local branch

git checkout branchname

Switch to the previous branch

git checkout -

Overview of local branches

git branch

Delete a local branch

git branch -d branchname

Insert changes on the server before your local changes

git pull --rebase

Temporarily discard local changes

git stash

Re-apply stashed away changes

git stash apply

Re-apply stashed away changes an delete them from stack

git stash pop

Find out who wrote something

git blame filename

Restore a deleted file (notice the space before and after the double dash)

git checkout -- filename

Martin Straub
Last edit
Daniel Straßner
License
Source code in this card is licensed under the MIT License.
Posted by Martin Straub to makandra dev (2010-08-25 12:06)