Sunday, 15 August 2010

Is there a safer way of moving a branch pointer than `git reset --hard`? -



Is there a safer way of moving a branch pointer than `git reset --hard`? -

when working git, tend utilize lot of "advanced" features rewrite , reorganize local history before pushing remote. 1 command utilize alter commit current branch pointing git reset --hard <commit>. unfortunately, command has potentially undesirable effects when run uncommitted changes in local directory. have lost work (though not much, tend commit often) in past due feature.

is there alternative git reset --hard changing commit current branch pointing to, doesn't cause loss of info when have uncommitted changes in working directory? (ideally, want git checkout changes current branch pointer instead of changing head.)

why like git checkout, when can utilize git checkout?

the alternative you're looking -b, checks out specified ref , either creates new branch it, or updates existing branch. works if specify branch you're on.

git

No comments:

Post a Comment