From: Igor Djordjevic <igor.d.djordjevic@gmail.com>
To: Josef Wolf <jw@raven.inka.de>
Cc: git@vger.kernel.org
Subject: Re: Need help migrating workflow from svn to git.
Date: Thu, 21 Dec 2017 23:04:09 +0100 [thread overview]
Message-ID: <fdf75150-eca0-dde5-a305-ae5fd5c35369@gmail.com> (raw)
In-Reply-To: <20171220114337.GE18542@raven.inka.de>
Hi Josef,
On 20/12/2017 12:43, Josef Wolf wrote:
>
>> $ git add -u
>> $ git reset
>
> This would be added after the "git checkout -m -B master FETCH_HEAD"
> command?
Yes, so it would be something like this:
git fetch origin master && #1
git checkout -m -B master FETCH_HEAD && #2
git add -u && #3
git reset #4
But it actually depends on what kind of default `git diff` output
you prefer.
In order to avoid failure on subsequent script runs, in case where
conflicts still exist, you need to ensure #3 and #4 are executed
before #1 and #2 are executed _again_.
So you may put #3 and #4 in front of #1 and #2, too, that would work
just as well, where `git diff` would now be showing "combined diff"[2]
as long as the script isn`t executed again (and it would keep showing
new "combined diff" from that point on).
>> Yes, `git diff` won`t be the same as if conflicts were still in, but
>> it might be worth it in this specific case, conflicting parts still
>> easily visible between conflict markers.
>
> That means, the conflict is still there, but git would think this is
> an ordinary modification?
Yes, as by that `git add -u` you confirm all merge conflicts are
resolved, and `git diff` output changes accordingly. You can read
more about "diff format for merges"[1] and "combined diff format"[2]
from `git-diff`[3] documentation.
Here are some examples from my test repositories. Local repo
introduces line "A1" (local modification, uncommitted), where remote
repo introduced line "B1" (commit). Steps #1 and #2 get executed, merge
conflicts shown with `git diff`, before `git add -u` and `git reset`:
$ git diff
diff --cc A
index 5314b4f,1e2b966..0000000
--- a/A
+++ b/A
@@@ -12,5 -12,5 +12,9 @@@
2
3
4
++<<<<<<< FETCH_HEAD
+B1
++=======
+ A1
++>>>>>>> local
5
... and after `git add -u` and `git reset` (note line "B1" not
showing as changed anymore):
$ git diff
diff --git a/A b/A
index 5314b4f..8ea9600 100644
--- a/A
+++ b/A
@@ -12,5 +12,9 @@ A
2
3
4
+<<<<<<< FETCH_HEAD
B1
+=======
+A1
+>>>>>>> local
5
Now, without any commits yet made locally (except commit pulled from
remote repo), local repo adds line "A2" where remote repo introduces
line "B2" (commit). Steps #1 and #2 get executed again, merge
conflicts shown with `git diff`, before `git add -u` and `git reset`:
$ git diff
diff --cc A
index 424ae9e,4aac880..0000000
--- a/A
+++ b/A
@@@ -2,7 -2,7 +2,11 @@@
1
2
3
++<<<<<<< FETCH_HEAD
+B2
++=======
+ A2
++>>>>>>> local
4
5
6
... and after `git add -u` and `git reset` (note showing line "B2" as
unchanged, and now showing leftover "conflicts" around "A1" here as
well, where previous "combined" diff discarded it as uninteresting
due to implied "--cc"[4] flag):
$ git diff
diff --git a/A b/A
index 424ae9e..77ad8e6 100644
--- a/A
+++ b/A
@@ -2,7 +2,11 @@ A
1
2
3
+<<<<<<< FETCH_HEAD
B2
+=======
+A2
+>>>>>>> local
4
5
6
@@ -13,5 +17,9 @@ A3
2
3
4
+<<<<<<< FETCH_HEAD
B1
+=======
+A1
+>>>>>>> local
5
Hope that helps. As usual, best to give it some try on your own :)
Regards, Buga
[1] https://git-scm.com/docs/git-diff#_diff_format_for_merges
[2] https://git-scm.com/docs/git-diff#_combined_diff_format
[3] https://git-scm.com/docs/git-diff
[4] https://git-scm.com/docs/git-diff-tree#git-diff-tree---cc
prev parent reply other threads:[~2017-12-21 22:04 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
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 [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
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=fdf75150-eca0-dde5-a305-ae5fd5c35369@gmail.com \
--to=igor.d.djordjevic@gmail.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).