git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Josef Wolf <jw@raven.inka.de>
Cc: git@vger.kernel.org
Subject: Re: Need help migrating workflow from svn to git.
Date: Fri, 15 Dec 2017 08:33:19 -0800	[thread overview]
Message-ID: <xmqqvah8q7cg.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171214130933.GA18542@raven.inka.de> (Josef Wolf's message of "Thu, 14 Dec 2017 14:09:33 +0100")

Josef Wolf <jw@raven.inka.de> writes:

> With git, by contrast, this won't work. Git will refuse to pull anything as
> long as there are ANY local modifications. The cron job would need to
>
>    git stash
>    git pull
>    git stash pop

I'd assume that this "pull" is expected to be fast-forward, as
otherwise you have no way of dealing with conflicted merges.

> But this will temporarily remove my local modifications. If I happen to do
> a test run at this time, the test run would NOT contain the local
> modifications which I was about to test. Even worse: if I happen to save
> one of the modified files while the modifications are in the stash, the
> "git stash pop" will definitely cause a conflict, although nothing really
> changed.
>
> So, how would I get this workflow with git? Is it possible to emulate the
> behavior of "svn update"?

You do not mind a temporary inconsistency while "svn update" runs
(it starts to update a file you may have local changes, but your
test may run while the update is in the middle of it).  So perhaps
something along the lines of this would help.  Assuming

    <remote> <branch>: the branch at the remote you are pulling from
    <master>: whatever branch you are using

are in your three-command example above:

    $ git fetch <remote> <branch>
    $ git checkout -m -B <master> FETCH_HEAD

should give you pretty-much identical result as

    $ git stash && git pull --ff-only && git stash pop

including a possible merge conflicts at 'git stash pop' stage.

  parent reply	other threads:[~2017-12-15 16:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 13:09 Need help migrating workflow from svn to git Josef Wolf
2017-12-14 21:07 ` Randall S. Becker
2017-12-15 10:27   ` Josef Wolf
2017-12-14 22:27 ` Igor Djordjevic
2017-12-15  1:17   ` Igor Djordjevic
2017-12-15 13:06     ` Josef Wolf
2017-12-15 12:47   ` Josef Wolf
2017-12-15 18:24     ` Igor Djordjevic
2017-12-15 16:33 ` Junio C Hamano [this message]
2017-12-15 18:58   ` Igor Djordjevic
2017-12-15 19:09     ` Junio C Hamano
2017-12-15 19:20       ` Igor Djordjevic
2017-12-20 11:52       ` Josef Wolf
2017-12-20 11:43     ` Josef Wolf
2017-12-20 12:19       ` Josef Wolf
2017-12-21 22:04       ` Igor Djordjevic

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: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqvah8q7cg.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jw@raven.inka.de \
    /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://80x24.org/mirrors/git.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).