hg-git icon indicating copy to clipboard operation
hg-git copied to clipboard

Support Force Push

Open cancan101 opened this issue 11 years ago • 11 comments

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?

cancan101 avatar Aug 11 '14 23:08 cancan101

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

paazmaya avatar Jan 14 '15 13:01 paazmaya

You might be able to get away with something like

cd .hg
ln -s git .git
git push -f ...

JasonGross avatar Feb 22 '15 01:02 JasonGross

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?

tamsky avatar May 29 '15 06:05 tamsky

Bump

Sumanai avatar Mar 06 '16 00:03 Sumanai

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

Psykar avatar Feb 21 '17 04:02 Psykar

@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.

vlad0337187 avatar May 30 '17 16:05 vlad0337187

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

Psykar avatar May 31 '17 23:05 Psykar

@Psykar, thanks

vlad0337187 avatar Jun 13 '17 18:06 vlad0337187

Strange, I downloaded last default branch from BitBucket 0.8.6 version, try to make: hg push -f git+ssh://[email protected]:vlad1777d/vlad1777d.github.io.git, but it returns: pushing to git+ssh://[email protected]: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 ?

vlad0337187 avatar Jul 12 '17 21:07 vlad0337187

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

jyc avatar Aug 02 '17 17:08 jyc

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

muxator avatar Jul 15 '18 20:07 muxator