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?
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.
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.
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 .
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With