* Avoid conflicting merges for the other user by using revert

Hi

Usually if two users push to a common repository conflicting merges might 
occur, and can be resolved manually.

I am faced with a situation (with students who don't know git and only use git 
via matlab's restricted git interface), 
where I don't want the other author (student) to be faced with the resolution 
of a conflicting merge.
The student should use always git pull (since matlab does not really support 
the merge command via its interface)
and if he/she runs into a conflict must run the only command line command

git merge --abort

and must report the conflict  to me.

I know that git (contrary to mercurial) is able to delete an already
pushed commit on the remote server, but frankly this is nothing I want
to mess with. So I thought I could use the =revert= command to have a
commit what corresponds to the commit before the conflicting commit. I
would push then, the student can pull and then push again and then I
could resolve the merging conflict

Perfect, the only problem is, it does not work as expected. (Strange enough it 
works if I use mercurial and the hg-git concerter) 

So here is the graph before the two conflicting commits
** Graph

#+begin_src 
,* commit 51a41427d578dbab6a5f20fb7195431ab54b931e (default~1)
| Author: Uwe <XXX@XXX>
| Date:   Mon Nov 20 17:16:42 2023 +0100
|
|     5: Six
|
,* commit 0261c4a7f3158b49a88993e2a34e1f0b7d7a97c8 (default~2)
| Author: Uwe <XXX@XXX>
| Date:   Mon Nov 20 17:16:42 2023 +0100
|
|     4: Fifth
|
#+end_src


Graphs after conflicting commits
** Student's graph
#+begin_src 
,* commit 7473468680c39cffbd2fc73fc0df7dd6bdb88b5e (default) (HEAD -> default)
| Author: Student <YYY@YYY>
| Date:   Tue Nov 21 09:14:42 2023 +0100
|
|     Student: Conflict RH is true
|
#+end_src
** My graph
#+begin_src 
,* commit 584569f61d84dca84ed03db635072a1724a56f0e (default) (HEAD -> default, 
origin/default, origin/HEAD)
| Author: Uwe <XXX@XXX>
| Date:   Tue Nov 21 09:15:03 2023 +0100
|
|     Uwe: Conflict RH is FALSE
|
#+end_src


** Problem: Solution git revert
#+begin_src 
,* commit 81d2d911da0cb5918ebaeac71a294ec60c1cd7f0 (default) (HEAD -> default, 
origin/default, origin/HEAD)
| Author: Uwe <XXX@XXX>
| Date:   Tue Nov 21 09:18:20 2023 +0100
|
|     Revert "Uwe: Conflict RH is FALSE", we are now as in commit 51a41427d
|
|     This reverts commit 584569f61d84dca84ed03db635072a1724a56f0e (default~1).
|
,* commit 584569f61d84dca84ed03db635072a1724a56f0e (default~1)
| Author: Uwe <XXX@XXX>
| Date:   Tue Nov 21 09:15:03 2023 +0100
|
|     Uwe: Conflict RH is FALSE
|
,* commit 51a41427d578dbab6a5f20fb7195431ab54b931e (default~2)
| Author: Uwe <XXX@XXX>
| Date:   Mon Nov 20 17:16:42 2023 +0100
|
|     5: Six
|
#+end_src


** Student: git pull+git push
#+begin_src 
,*   commit 955efa3a7b9cc28fe6fb3c4c60d4b1284acfabc7 (default) (HEAD -> 
default, origin/default, origin/HEAD)
|\  Merge: 7473468 81d2d91
| | Author: Student <YYY@YYY>
| | Date:   Tue Nov 21 09:19:32 2023 +0100
| |
| |     Merge branch 'default' of 
/home/oub/HGTest/1-Backout-Merge/Git-Merges-Matlab-no-conflict/Student/../Server
 into default
| |
| * commit 81d2d911da0cb5918ebaeac71a294ec60c1cd7f0 (default^2)
| | Author: Uwe <XXX@XXX>
| | Date:   Tue Nov 21 09:18:20 2023 +0100
| |
| |     Revert "Uwe: Conflict RH is FALSE", we are now as in commit 51a41427d
| |
| |     This reverts commit 584569f61d84dca84ed03db635072a1724a56f0e 
(default^2~1).
| |
| * commit 584569f61d84dca84ed03db635072a1724a56f0e (default^2~1)
| | Author: Uwe <XXX@XXX>
| | Date:   Tue Nov 21 09:15:03 2023 +0100
| |
| |     Uwe: Conflict RH is FALSE
| |
,* | commit 7473468680c39cffbd2fc73fc0df7dd6bdb88b5e (default~1)
|/  Author: Student <YYY@YYY>
|   Date:   Tue Nov 21 09:14:42 2023 +0100
|
|       Student: Conflict RH is true
|
#+end_src

** Uwe git pull

#+begin_src 
,*   commit 955efa3a7b9cc28fe6fb3c4c60d4b1284acfabc7 (default) (HEAD -> 
default, origin/default, origin/HEAD)
|\  Merge: 7473468 81d2d91
| | Author: Student <YYY@YYY>
| | Date:   Tue Nov 21 09:19:32 2023 +0100
| |
| |     Merge branch 'default' of 
/home/oub/HGTest/1-Backout-Merge/Git-Merges-Matlab-no-conflict/Student/../Server
 into default
| |
| * commit 81d2d911da0cb5918ebaeac71a294ec60c1cd7f0 (default^2)
| | Author: Uwe <XXX@XXX>
| | Date:   Tue Nov 21 09:18:20 2023 +0100
| |
| |     Revert "Uwe: Conflict RH is FALSE", we are now as in commit 51a41427d
| |
| |     This reverts commit 584569f61d84dca84ed03db635072a1724a56f0e 
(default^2~1).
| |
| * commit 584569f61d84dca84ed03db635072a1724a56f0e (default^2~1)
| | Author: Uwe <XXX@XXX>
| | Date:   Tue Nov 21 09:15:03 2023 +0100
| |
| |     Uwe: Conflict RH is FALSE
| |
,* | commit 7473468680c39cffbd2fc73fc0df7dd6bdb88b5e (default~1)
|/  Author: Student <YYY@YYY>
|   Date:   Tue Nov 21 09:14:42 2023 +0100
|
|       Student: Conflict RH is true
|
#+end_src

=git merge  584569f61d84dca84ed03db=
Already up to date.

What the f....

So what do I miss here.



-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/87o7fnxfop.fsf%40mat.ucm.es.

-- 
I strongly condemn Hamas heinous atrocities on Israel, especially the 
despicable pogroms.
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/87o7fnxfop.fsf%40mat.ucm.es.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to