Git for SVN Users
Mar. 25, 2016
What is Git?
(from the source's README file)
-
random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant.
-
stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
-
"global information tracker": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
-
"goddamn idiotic truckload of sh*t": when it breaks
But seriously...
- Created by Linux Torvalds and the Linux Kernel team in 2005
- A Distributed Revision Control System
- Design Goals: Fast, Resilient, and Non-Linear
- Per the Eclipse Foundation in 2014: 42.9% of developers use it as their primary SCM tool
Git Commands
and their SVN counterparts
git <command> <args>
help with a command?
man git-<command> git help <command>
Also:
man git man gittutorial man giteveryday
https://git-scm.com
Setup
git config --global user.name "David Fetterman"
git config --global user.email "dfetterman@merkleinc.com" git config --global --list git config --local git config --global --edit git config --global alias.co checkout git config --global alias.unstage 'reset HEAD --'
Changes
git checkout <path>
git diff git diff <rev> <path> git status
git add <file> git mv <file> git rm <file>
git commit -a
svn diff | less svn diff -r<rev> <path> svn status
svn revert <path>
svn add <file> svn mv <file> svn rm <file>
svn commit
Oops...
You can fix a mistake!
Missed something:
git commit --amend
Rollback:
git reset HEAD^
History
git log
git blame <file>
svn log | less
svn blame <file>
git show <rev:path/to/file> git show <rev:path/to/dir/> git show <rev>
svn cat <url> svn list <url> svn log <url> svn diff <url>
Tagging & Branching
git tag -a <tag>
svn copy <url:path/trunk> <url:path/tags/name>
git branch <name>
git checkout <name>
git checkout -b <name>
svn copy <url:path/trunk> <url:path/branches/branch> svn switch <url:path/branches/branch>
git branch
svn list <url:path/branches>
git checkout <rev>
svn update -r<rev>
Remote Work
git clone <url>
svn checkout <url>
git add remote <remote> <url> git remote git remote show <name> git checkout -b <branch> <remote/branch>
svn switch <url>
git fetch
git merge
git pull
svn update
git push
svn commit
Demo
deck
By davefett
deck
- 723