Skip to content

Instantly share code, notes, and snippets.

@jzi96
Last active February 15, 2016 07:32
Show Gist options
  • Save jzi96/5334799 to your computer and use it in GitHub Desktop.
Save jzi96/5334799 to your computer and use it in GitHub Desktop.
Some usefull GIT commands * usage with SVN * configuration * alias
## patching
git format-patch -M origin/master
git am < patchfilename.patch
##Mirror an repository
for remote in `git branch -r | grep -v master `; \
do git checkout --track $remote ; done
git push --all ssh://repo.git
git push --tagsssh://repo.git
#CLONE an SVN REPO
git svn clone <REPO> --prefix=svn/ -s --no-minimize-url -r 100000:HEAD
#GIT MERGE
git merge <FROMBRANCH> -s recursive -Xtheirs --no-ff
#revert set of revisions
#in command line
#special single quote character!
for r in `git rev-list 87407d708c20e0e2f09e9e519a0753f98044591b...HEAD`;do git revert --no-edit -s $r; done
#create a new git-svn branch
git svn branch -m "Mycomment" <branch_name>
#sync tags with remote, drop local
git fetch --prune <remote> +refs/tags/*:refs/tags/*
#List all branches that have been merged
git branch -r --merged | grep -v master | grep -v develop | sed 's/origin\///' | xargs -n 1 git push --delete origin
#alternative
git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
grep -v develop |
xargs -L1 |
cut -d"/" -f2-
#configuration sections / customization
[diff]
tool = tortoise
[difftool "tortoise"]
cmd = "\"c:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe\" -base:\"$LOCAL\" -mine:\"$REMOTE\""
[difftool]
prompt = true
[merge]
tool = tortoise
[mergetool "tortoise"]
cmd = "\"c:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe\" -base:\"$BASE\" -theirs:\"$REMOTE\" -mine:\"$LOCAL\" -merged:\"$MERGED\""
[alias]
c = commit -asm
mt = mergetool -y
dt = difftool -y
s = show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment