Version control systems - git example find changes which could be lost

Marc Weber marco-oweber at gmx.de
Thu Aug 21 22:48:42 EDT 2008


On Tue, Aug 12, 2008 at 03:17:59PM -0400, Isaac Dupree wrote:
>  Thomas Schilling wrote:
> > I encourage everyone to add useful tips and examples both from users who 
> > already use Git and later on, once we have gathered more experience.  I 
> > believe that Git has some features which can improve our productivity and 
> > I'd like this page to also collect tips how to do so.
> 
>  what about `darcs send --dry-run`?  It's not perfect, but I use it in my old 
>  repos in conjunction with `darcs wh [-l]` to find out what of value I'd lose 
>  by deleting an old checkout.  (e.g., patches merged into HEAD aren't of 
>  value.  But they still aren't of value even if they've been amend-recorded, 
>  rewritten, or equivalent by simon/ian/etc., but Darcs can't tell this, 
>  unfortunately.)
> 
>  -Isaac

Hi Isaac, 

git rebase can do this partially. See this example
that's what I know about (make sure you don't have important
data in /tmp/xx) How intelligent git behaves on partially applied /
cherry picked commits I don't know.

#!/bin/sh
echO(){ echo;  echo " >>>>   $@"; echo 'return to continue'; read; }
evaL(){ echo; echo "cmd: $@"; eval "$@"; }
cd /tmp/xx || exit 1
rm -fr * .*
set -e
git init
addfile(){ 
  echo $1 > $1
  git add $1
  git commit -m $1 -a
}
evaL 'addfile a'
evaL 'addfile b'
evaL 'addfile c'
evaL 'addfile d'
echO 'a,b,c,d recorded succesfully'
evaL 'git checkout HEAD~2'
echO 'gone back two commits'
evaL 'git checkout -b mutate'
echO 'branch mutate created'
evaL 'addfile new'
echO 'new file new added which would be lost'
evaL 'git cherry-pick master'
evaL 'git cherry-pick master^'
echO 'cherry picked d c in reverse order, look at popping up gitk now (you may want to keep it open)'
evaL 'gitk --all &'
echO 'continue after gitk has popped up, you should see one branch'
evaL 'git checkout -b rebased'
evaL 'git rebase master rebased'
echO 'tried rebasing, data which would be lost should be ahead of master now'
echO 'opening second gitk showing current repo state'
evaL 'gitk --all'
echO 'if this is not enough, you can always use git-diff:'
evaL 'git diff mutate master'


More information about the Glasgow-haskell-users mailing list