From: Philipp Stephani <p.stephani2@gmail.com>
To: Jean-Christophe Helary <jean.christophe.helary@gmail.com>,
emacs-devel <emacs-devel@gnu.org>
Subject: Re: best workflow with git ?
Date: Sun, 11 Jun 2017 08:43:46 +0000 [thread overview]
Message-ID: <CAArVCkSP4ip-Jmz5oNR2x_c2PHxTyXtEr8nec4Awbu1ST-QViQ@mail.gmail.com> (raw)
In-Reply-To: <BC92739F-BC27-4EAE-BA7D-DD1FB896E766@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2296 bytes --]
Jean-Christophe Helary <jean.christophe.helary@gmail.com> schrieb am Sa.,
10. Juni 2017 um 17:04 Uhr:
> I'm not used to git and I see that I'm not doing the right thing locally.
> I'd like to know the workflow that would work the best for what I'm doing.
>
> 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.
>
Yes, don't commit to local master. A common workflow is to do all work in
local branches.
>
> What should I do ? Create a branch where I do all my modifications ?
Yes, exactly. Typically you start with
git checkout master
git pull --ff-only
git checkout -b topic-branch master
# now work on the topic branch
git commit
If the topic branch gets too old, you should rebase it:
git checkout master
git pull --ff-only
git rebase master topic-branch
> And then do a git diff to create a patch that I send here ?
Yes, but use git format-patch (or git send-email to send the mail directly):
# Maybe rebase as above
git checkout topic-branch
git format-patch master
> When the patch has been applied, what should I do with the branch and the
> modified files ?
>
Rebase one more time, then delete the branch:
git checkout master
git pull --ff-only
git rebase master topic-branch
git checkout master
git branch -d topic-branch
If the patch has been applied, the topic branch will be identical to
master, and Git will immediately delete it. Otherwise it will not delete
it, and there are some changes that are not yet in master.
Once you get commit access to Savannah, you can also push yourself to
master:
git checkout master
git pull --ff-only
git rebase master topic-branch
git checkout master
git merge topic-branch --ff-only
git push
This workflow works well, allows you to work on many topics in parallel,
and keeps history clean. The maybe somewhat non-obvious rule is to always
rebase the topic branches and fast-forward master; you can use 'git config
merge.ff only' to disallow all non-fast-forward merges.
[-- Attachment #2: Type: text/html, Size: 3440 bytes --]
prev parent reply other threads:[~2017-06-11 8:43 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
2017-06-11 8:43 ` Philipp Stephani [this message]
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=CAArVCkSP4ip-Jmz5oNR2x_c2PHxTyXtEr8nec4Awbu1ST-QViQ@mail.gmail.com \
--to=p.stephani2@gmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.