From: Jonathan Nieder <jrnieder@gmail.com>
To: Jeffrey Walton <noloader@gmail.com>
Cc: Stefan Beller <sbeller@google.com>, Git List <git@vger.kernel.org>
Subject: Re: How to force a push to succeed?
Date: Wed, 23 Aug 2017 09:56:34 -0700 [thread overview]
Message-ID: <20170823165634.GI13924@aiede.mtv.corp.google.com> (raw)
In-Reply-To: <CAH8yC8nHnbWTG4hxD+mEHKPS6eWcBb7yMsgN886=aTWaBRhE5A@mail.gmail.com>
Hi Jeffrey,
Jeffrey Walton wrote:
> From another testing machine, it looks like the changes have not been
> backed out. The previous operation un-did the ADX gear because it was
> an evolutionary dead-end.
>
> via$ git pull
> From https://github.com/noloader/cryptopp
> + 66654dd...559fc3b master -> origin/master (forced update)
The Git User Manual[1] explains:
| We have already seen how to keep remote-tracking branches up to date
| with git-fetch(1), and how to merge two branches. So you can merge
| in changes from the original repository’s master branch with:
|
| $ git fetch
| $ git merge origin/master
|
| However, the git-pull(1) command provides a way to do this in one step:
|
| $ git pull origin master
There is also some discussion of that in "git help pull".
But that doesn't appear to be what you want to do. You are not
looking to incorporate remote changes into your local branch,
preserving any changes that are in your local branch --- instead, you
are looking to move to what the remote server has, overwriting any
changes that are in your local branch.
You can do that with
git fetch
git reset --hard origin/master
See also the discussion of --force in "git help push".
I also recommend looking at the Git Tutorial[2]. When it introduces
"git reset --hard" to back out changes, it says:
| $ git reset --hard HEAD^ # reset your current branch and working
| # directory to its state at HEAD^
|
| Be careful with that last command: in addition to losing any changes
| in the working directory, it will also remove all later commits from
| this branch. If this branch is the only branch containing those
| commits, they will be lost. Also, don’t use git reset on a
| publicly-visible branch that other developers pull from, as it will
| force needless merges on other developers to clean up the history.
| If you need to undo changes that you have pushed, use git revert
| instead.
If you have ideas about how it could explain this better (or even
better, how commands could behave to avoid needing such explanation)
then I would be happy to hear them.
(Side note: I am starting to wonder whether what you were looking for
was something like "git revert", especially if this is a project
involving more than one person.)
> You know, I look at how fucked up yet another simple workflow is, and
> all I can do is wonder. It is absolutely amazing. Its like the project
> goes out of its way to make simple tasks difficult.
I understand your frustration, but accusing people of trying to make
your life difficult isn't a particularly productive way to get help
from them.
For the future, some ways to get good results are
- to describe the background of what you are trying to do
- to describe where you looked for answers, so that we know what
documentation to improve
The #git IRC channel on freenode can also be helpful for real-time
help. But I encourage you to also keep writing here so that we know
what documentation and workflows to improve.
Thanks and hope that helps,
Jonatha
[1] https://www.kernel.org/pub/software/scm/git/docs/user-manual.html#getting-updates-With-git-pull
[2] https://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
next prev parent reply other threads:[~2017-08-23 16:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 21:55 How to force a push to succeed? Jeffrey Walton
2017-08-22 21:57 ` Stefan Beller
2017-08-22 22:03 ` Jeffrey Walton
2017-08-22 22:10 ` Jeffrey Walton
2017-08-22 22:26 ` Jeffrey Walton
2017-08-23 17:06 ` Johannes Sixt
2017-08-23 16:56 ` Jonathan Nieder [this message]
2017-08-23 8:03 ` Kevin Daudt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170823165634.GI13924@aiede.mtv.corp.google.com \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=noloader@gmail.com \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox