Last active
August 29, 2015 14:06
-
-
Save amsterdatech/f8a321e238f3430ae5a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git to SVN | |
================ | |
-Create users.txt with the format | |
schacon = Scott Chacon <schacon@geemail.com> | |
selse = Someo Nelse <selse@geemail.com> | |
-Or on svn run | |
svn log ^/ --xml | grep -P "^<author" | sort -u | \ | |
perl -pe 's/<author>(.*?)<\/author>/$1 = /' > users.txt | |
-Clone | |
git-svn clone http://my-project.googlecode.com/svn/ \ | |
--authors-file=users.txt --no-metadata -s my_project | |
-From svn tags (ugly dirs) to lightweight Git tags | |
cp -Rf .git/refs/remotes/tags/* .git/refs/tags/ | |
rm -Rf .git/refs/remotes/tags | |
-From svn branches (ugly dirs) to lightweight Git branches | |
cp -Rf .git/refs/remotes/* .git/refs/heads/ | |
rm -Rf .git/refs/remotes | |
-Now add your center repository and push to it | |
git remote add origin git@my-git-server:myrepository.git | |
git push origin --all | |
================= | |
UNDO THINGS | |
================= | |
git revert http://hacklab.com.br/2013/04/03/o-git-revert/ | |
git reflog http://alblue.bandlem.com/2011/05/git-tip-of-week-reflogs.html | |
git reset --hard HEAD | |
git config --global alias.undo "reset HEAD@{1}" | |
http://erikos.buchoase.de/2012/09/03/git-tip-of-the-day-git-reflog-or-how-to-undo-a-git-rebase/ | |
git reflog | |
git reset --hard HEAD{0} | |
git commit --amend change message or forgot staged files (add state) | |
git diff {d.unit.ago} http://alblue.bandlem.com/2011/05/git-tip-of-week-reflogs.html | |
{8.hours.ago} | |
undo a merge | |
git reset --hard HEAD | |
========================= | |
Create a branch | |
========================= | |
git log --pretty=oneline master | |
git update-ref refs/heads/master 1a410efbd13591db07496601ebc7a059dd55cfe9 | |
git update-ref refs/heads/test cac0ca | |
from any branch or even master to put your current changes on a new branch | |
git checkout -b branch_name | |
Config | |
source ~/.git-completion.bash | |
Alias | |
$ git config --global alias.co checkout | |
$ git config --global alias.br branch | |
$ git config --global alias.ci commit | |
$ git config --global alias.st status | |
$ git config --global core.editor emacs | |
$ git config --global user.name "John Doe" | |
$ git config --global user.email johndoe@example.com | |
Diffs with gitk or meld | |
============================ | |
$ git config --global alias.visual '!gitk' | |
[merge] | |
tool = extMerge | |
[mergetool "extMerge"] | |
cmd = extMerge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\" | |
trustExitCode = false | |
[diff] | |
external = extDiff | |
osx - Install gitk on Mac - Stack Overflow | |
git instaweb --httpd=webrick or on Linux httpd | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment