Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push 'refs/replace' without pushing any other refs in git?

Tags:

git

I have done a replacement of one commit with another in this way:

* HEAD
|
...
|
* ==> *  `git replace left_commit right_commit`
|     |
*-----/
|
...

This replacement is placed in .git/refs/replace folder, so I wonder - how can I push this refs to the remote end?

like image 342
abyss.7 Avatar asked Nov 19 '13 10:11

abyss.7


People also ask

Can you git commit without pushing?

So commiting changes without pushing allow the save-load behaviour done locally during development. Once you are happy with your work, you then commit AND push.

Do git pull before pushing again?

You need to pull before push, to make your local repository up-to-date before you push something (just in case someone else has already updated code on github.com ). This helps in resolving conflicts locally. 'origin' is a remote. You can use git remote --verbose to see all the remote configured under your git folder.

How does git replace work?

The replace command lets you specify an object in Git and say "every time you refer to this object, pretend it's a different object". This is most commonly useful for replacing one commit in your history with another one without having to rebuild the entire history with, say, git filter-branch .

How do I push commit to another repository?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.


1 Answers

Found the answer in mailing-list:

git push origin 'refs/replace/*'
git fetch origin 'refs/replace/*:refs/replace/*'

Only explicit pushing and fetching do work right now in git.

like image 126
abyss.7 Avatar answered Oct 06 '22 01:10

abyss.7