- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
git branch management (alternate title: less is moors)
Fri, 2012-02-17, 01:39
I'm sure I'm not the only person saddled with a bunch of git branches based on svn about which we/I feel daily generalized anxiety.
Oh look, adriaan has 363 branches, he'll make a nice test case.
# adriaan's https://github.com/adriaanm/scala-my-svn # mine after running a couple programs https://github.com/adriaan-less/scala-your-svn
The programs I ran are "git-remaster" and "git-branches-remaster" found here:
https://github.com/paulp/libscala
Another program of interest is "git-branches-status", also in libscala. I know gmail will savage the columns so I attached abridged output as a text file, maybe I'll have better luck.
The upshot is that all those branches are now based on current master, with minimal damage to the content. The merge strategy always prefers the non-master branch over master, so no information should be lost, though of course that is often not the choice a human will make later if they want to see their code in trunk.
There are other new bits in libscala, including a selection of frequent visitors to my keyboard:
alias g='git'
# branching, committing alias gbgrep='git branch -a | grep $*'alias gco='git checkout $*'alias gup='git checkout master && git pull && git remote update -p'alias gupd='git commit -a --amend -C HEAD' alias gam='git commit -a -m'
# merging, rebasing, modifying the treealias grh='git reset --hard'alias grhh='git reset --hard HEAD^'alias gmm='git merge master' alias grm='git rebase master'alias grim='git rebase -i master'alias gra='git rebase --abort'
# log/infoalias glog-nm='git log --no-merges ^master' alias glog-this='git log --no-merges ^master HEAD'alias glog..='git log --no-merges master.. -- src'alias glog2="git log --simplify-by-decoration --date-order --format='%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev=10 --abbrev-commit --graph --decorate --date=relative" alias glog3="git log --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%an%Creset %m - %s %Cgreen(%cr)%Creset' --abbrev=10 --abbrev-commit --date=relative"alias gdesc='git describe --always'
# diffalias gdm='git diff master'alias gds='git diff --stat=150,150'alias gdsh='git diff --stat=150,150 HEAD^'alias gdsm='git diff --stat=150,150 master' alias gdh='git diff HEAD^ HEAD'alias gdm...='git diff master... -- src'alias gdsm...='git diff -w --stat master... -- src'
# obscurer but useful things alias git-checkout-all='git fetch . refs/remotes/*:refs/HEADs/*'alias git-local-checkout-all='git co HEAD^ && git fetch . refs/remotes/origin/*:refs/HEADs/* && git co master && git branch -D HEAD' alias git-show-blobs='git verify-pack -v .git/objects/pack/pack-*.idx | sort -k3n'alias git-ls-remote-tags='git ls-remote --tags origin'
Oh look, adriaan has 363 branches, he'll make a nice test case.
# adriaan's https://github.com/adriaanm/scala-my-svn # mine after running a couple programs https://github.com/adriaan-less/scala-your-svn
The programs I ran are "git-remaster" and "git-branches-remaster" found here:
https://github.com/paulp/libscala
Another program of interest is "git-branches-status", also in libscala. I know gmail will savage the columns so I attached abridged output as a text file, maybe I'll have better luck.
The upshot is that all those branches are now based on current master, with minimal damage to the content. The merge strategy always prefers the non-master branch over master, so no information should be lost, though of course that is often not the choice a human will make later if they want to see their code in trunk.
There are other new bits in libscala, including a selection of frequent visitors to my keyboard:
alias g='git'
# branching, committing alias gbgrep='git branch -a | grep $*'alias gco='git checkout $*'alias gup='git checkout master && git pull && git remote update -p'alias gupd='git commit -a --amend -C HEAD' alias gam='git commit -a -m'
# merging, rebasing, modifying the treealias grh='git reset --hard'alias grhh='git reset --hard HEAD^'alias gmm='git merge master' alias grm='git rebase master'alias grim='git rebase -i master'alias gra='git rebase --abort'
# log/infoalias glog-nm='git log --no-merges ^master' alias glog-this='git log --no-merges ^master HEAD'alias glog..='git log --no-merges master.. -- src'alias glog2="git log --simplify-by-decoration --date-order --format='%Cred%h%Creset %s %Cgreen(%cr)%Creset' --abbrev=10 --abbrev-commit --graph --decorate --date=relative" alias glog3="git log --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%an%Creset %m - %s %Cgreen(%cr)%Creset' --abbrev=10 --abbrev-commit --date=relative"alias gdesc='git describe --always'
# diffalias gdm='git diff master'alias gds='git diff --stat=150,150'alias gdsh='git diff --stat=150,150 HEAD^'alias gdsm='git diff --stat=150,150 master' alias gdh='git diff HEAD^ HEAD'alias gdm...='git diff master... -- src'alias gdsm...='git diff -w --stat master... -- src'
# obscurer but useful things alias git-checkout-all='git fetch . refs/remotes/*:refs/HEADs/*'alias git-local-checkout-all='git co HEAD^ && git fetch . refs/remotes/origin/*:refs/HEADs/* && git co master && git branch -D HEAD' alias git-show-blobs='git verify-pack -v .git/objects/pack/pack-*.idx | sort -k3n'alias git-ls-remote-tags='git ls-remote --tags origin'