From: Alan Third <alan@idiocy.org>
To: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: best workflow with git ?
Date: Sat, 10 Jun 2017 18:14:16 +0100 [thread overview]
Message-ID: <20170610171416.GB95401@breton.holly.idiocy.org> (raw)
In-Reply-To: <BC92739F-BC27-4EAE-BA7D-DD1FB896E766@gmail.com>
On Sun, Jun 11, 2017 at 12:04:06AM +0900, Jean-Christophe Helary wrote:
> I got the repository from Savannah and each time I want to update it
> I do a "git pull origin master". If I have worked on some files
> before that I usually get a message asking me to commit my files
> otherwise they'd be overwritten. Since I'm not pushing anything to
> Savannah I feel that committing to the local Master is useless and
> will only create discrepancies between my repository and Savannah.
I find the easiest way to deal with this is to commit the change, and
then pull using -r
git pull -r
to rebase my unpushed commit back on the top.
I can then use
git commit --amend
to make further changes to that commit, but make sure you NEVER amend
a commit that you’ve already pushed to the repository because that
breaks things.
If you then want to get rid of the commit you can just do
git reset --hard HEAD~1
The number at the end represents the number of commits you want to
delete. If you only want to delete your unstaged changes (and staged
too? I’m not sure) you can do
git reset --hard
It’s safe to delete too many commits as a git pull will bring you
right back up to date with the repository again.
An alternative I’ve used in the past is to stash the files and then
pop them back once I’ve finished with the pull, but I find committing
them locally and rebasing is often neater, especially if I have
installed someone else’s patches for testing and therefore have
multiple unpushed commits.
--
Alan Third
next prev parent reply other threads:[~2017-06-10 17:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-10 15:04 best workflow with git ? Jean-Christophe Helary
2017-06-10 15:23 ` Dmitry Gutov
2017-06-10 15:40 ` Ingo Lohmar
2017-06-10 17:11 ` Eli Zaretskii
2017-06-10 17:14 ` Alan Third [this message]
2017-06-11 8:43 ` Philipp Stephani
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170610171416.GB95401@breton.holly.idiocy.org \
--to=alan@idiocy.org \
--cc=emacs-devel@gnu.org \
--cc=jean.christophe.helary@gmail.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).