Sunday, 15 January 2012

git - Go to an old commit and push temporary changes to remote -



git - Go to an old commit and push temporary changes to remote -

i have repo on bitbucket, , have specific branch called "staging" when force it, updates code on our server automatically.

i need go 10 commits before see if bug introduced in lastly commits.

locally, tried git checkout <commit-sha> while beingness in staging branch, , had create new branch (i'm using smartgit). how utilize new branch staging, or revert staging , force bitbucket?

option 1: force-push staging branch

you can temporarily hard reset staging branch on remote force-pushing new branch, alternative long have understanding coworkers temporary, , should not base of operations new code off of reset staging branch.

assuming new branch you've created called x, can following:

git force bitbucket x:staging -f

x:staging "refspec", says "take local branch x, , force it's contents staging branch on remote". -f of course of study forcefulness force option.

option 2: temporarily revert lastly 10 commits on staging branch

another alternative temporarily revert lastly 10 commits, force staging branch, hard reset original state when you're done testing, , forcefulness force original state back.

you can revert commits using git revert.

git bitbucket smartgit

No comments:

Post a Comment