schacon / hg-git

mercurial to git bridge, pushed to directly from the hg-git plugin in Hg
GNU General Public License v2.0
620 stars 71 forks source link

Support Force Push #285

Open cancan101 opened 9 years ago

cancan101 commented 9 years ago

I am using hg-git to maintain a mirror of an hg repository but my git repos has some additional commits (my own). Whenever the hg repos has new commits, I want to pull those commits to git but then perform a rebase of my local commits to end of the hg history. That way I maintain the history from the upstream repos. Once the rebase is done, I need to force push to git.

What is the best way to do this with hg-git?

paazmaya commented 9 years ago

:+1: for the possibility to use --force on a git push mapped command

JasonGross commented 9 years ago

You might be able to get away with something like

cd .hg
ln -s git .git
git push -f ...
tamsky commented 8 years ago
cd .hg
ln -s git .git
git push -f <remote-clone-url>

@JasonGross thanks for the tip.

hg strip -r REV followed by the above was exactly what I needed.

I'm thinking it's probably ok to leave the .git symlink around. Can anyone offer a reason why leaving it around might be a bad idea?

Sumanai commented 8 years ago

Bump

Psykar commented 7 years ago

Unsure when it was added, but hg push -f does work for this now.

vlad0337187 commented 6 years ago

@Psykar , which version do you use ? I use 0.8.5-2 from Ubuntu repository with Mercurial 3.7.3, and it's absent there.

Psykar commented 6 years ago

@vlad1777d I'm on the current head with hg 4.2, so not particularly surprising I guess.

vlad0337187 commented 6 years ago

@Psykar, thanks

vlad0337187 commented 6 years ago

Strange, I downloaded last default branch from BitBucket 0.8.6 version, try to make: hg push -f git+ssh://git@github.com:vlad1777d/vlad1777d.github.io.git, but it returns: pushing to git+ssh://git@github.com:vlad1777d/vlad1777d.github.io.git searching for changes abort: branch 'refs/heads/master' changed on the server, please pull and merge before pushing

Seems, commit, that allows force pushing, was made in 2009 year.. abderrahim | 51e4d6e | rework pushing to support --rev and --force options | 2009-07-31

What is the problem ?

jyc commented 6 years ago

I also just ran into this issue. Anything I could do to help?

muxator commented 5 years ago

I was not able to hg push --force, I had to cd .hg/git and git push --force from there. A bit uncomfortable.