How can I push git-replace to a remote repo? -


i have used "git replace" substitute branch (with no common ancestor) 22b2b25 commit in master. want change permanent. i'm not interested in previous history. in output below top 5 commits original master branch , bottom 2 come different branch.

when pushed new repository git-replace lost , old history reappeared. there way make change permanent?

branch master looks below in original repo. want see in remote repo , subsequent clones.

[mike@localhost canal_site]$ git log --oneline --decorate cdf0ae3 (head, origin/master, master) mm: sqlencode course name ad-hoc courses 2b57df5 mm: fixes changes far 7916eaf mm: ad hoc - more refactoring 1e00d22 mm: reformatted code e36cee1 factored out equal ops 22b2b25 (origin/prod20140313, prod20140313) initial load production 9-june-2015 08379cd initial inclusion of production files 9-june-2015 

git replace alone isn't enough: replacing 1 commit isn't enough.

the next commit must reference replaced commit parent.

as mentioned in "removing whole bunch of commits git":

backup repo via git clone.
find out first commit after commits not like , remember hash of direct ancestor (in following bbb).
find first commit before commits not (in following aaa):

git replace bbb aaa 

take @ repository (with git log) , check whether should after intended change.
replace command adds meta information .git/refs/replace, git commands interpret correspondingly.
in order make these changes permanent, may use git filter-branch:

git filter-branch -- --all 

then need force push (git push --force) in order override remote repo new history of branch. or van push new empty bare repo.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -