Reset git repository to specific commit from specific branch -


i working on branch in following state

        a'--b'--c'--d'        / a--b--c--d 

some bad things happened , have go b' both locally , remote remote repository following

         a'--b'         /  a--b--c--d 

for local repository did

git reset --hard <sha> 

but how can remote repository?

i should able like

git push origin mybranch --reset

but it's not in man page

i tried creating commit cancel previous ones but

git add .

reports there no changes (expected since i'm after previous push)

so how can reset remote repository?

removing commit history

all need on b' branch, , go git push --force overwrite current commit pointer branch. if don't have remotes set tracking branches, may need git push --force origin <branchname> instead.

c' , d' remain in reflog , objects in repository until pruned, shouldn't show part of log history unless start digging plumbing.

removing dangling objects repository

if want c' , d' out of repository altogether, can call git prune --expire now in both repositories. should remove dangling objects altogether.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -