Why isn't the git log displayed in chronological order and the code is removed?

We have a strange problem with our git branch, which I hope to have more understanding of than the problem itself. I'll describe our workflow as best I can to make sure we're missing something obvious:

One of the teams made a branch with git checkout -b newproject

, then made a few changes, and then pushed those changes with git push -u origin new project

. Then other developers joined the project using git fetch origin

and then git checkout newproject

.

Further, the workflow looks like this. Developers make changes, git add

new and changed files and git commit

periodically. Then when they want everyone else to see their changes, they will do git pull origin newproject

to get any changes since the last click, and then git push -u origin newproject

.

Note: In /etc/gitconfig

we have the following:

[branch]
autosetuprebase = always

      

We often run into conflicts when pull

ing, as we work a lot on the same files. When we do, we will receive instructions on how to manually resolve conflicts and then run git rebase --continue

. We open the files, select the code we want to save, and make the necessary changes and save. Then we git add filename.ext

, when they are resolved, then run git rebase --continue

. After this is over, when git status

showing that there are no changes, on the branch newproject

and ahead of X, we commit, we use git push -u origin newproject

.

We noticed this morning that large chunks of code suddenly disappeared. At launch, the git log

first thing we noticed was that it was not in chronological order as the manual suggests .

commit bc0903fc5795425908f335cebcab11055869d75d
Author: billy <billy@our.biz>
Date:   Thu Sep 11 15:29:37 2014 +0100

    Add responsive skin to sectionProducts

commit 7833850313c2974c3b8cbc75383b1834fbf4bf93
Author: bob <bob@our.biz>
Date:   Thu Sep 11 14:44:37 2014 +0100

    Rewrite the way breadcrumbs are generated and output to the page

commit 09d1318d9e7249e9e45826d7ddc33f23fc5974b1
Author: bob <bob@our.biz>
Date:   Thu Sep 11 11:25:21 2014 +0100

    Fix styles for video and featured product boxes, fix miscellaneous bugs and remove obselete code

commit 13f01644935092b490be55b6738f500f0f5fcb2e
Author: bob <bob@our.biz>
Date:   Thu Sep 11 08:31:03 2014 +0100

    Fix section.html, add featured products, star buy products and product videos

commit 01b3bfb3c20f74ea437b221711deabc970f670d8
Author: bob <bob@our.biz>
Date:   Fri Sep 12 08:45:19 2014 +0100

    Refine code for breadcrumbs

commit 0303bae79f7ff2e84221e0db3f88d3630d4afa91
Author: bob <bob@our.biz>
Date:   Thu Sep 11 15:53:06 2014 +0100

    Modify getBreadcrumbTrail so that it attempts to take the correct route when recursing

commit 1ae5f00814bf216eda5449a6e8d89123b124fad8
Author: bob <bob@our.biz>
Date:   Thu Sep 11 14:44:37 2014 +0100

    Rewrite the way breadcrumbs are generated and output to the page

      

Also some commits appear, duplicate. Another point to note is that one of the developers noted that after seeing some conflicts and resolving them, then running git rebase --continue

them, they were shown a different list of conflicts. This happened several times before they were all resolved, before they could push.

Update: We noticed that the issues are a little explainable, which was originally intended. As long as, and including when bob pushed his commits, before the commit 01b3bfb3c20f74ea437b221711deabc970f670d8

with the date, Fri Sep 12 08:45:19 2014 +0100

everything was correct. It was ordered chronologically and the code was correct. The following 3 fixing bob are in fact the same 3 commits to the message, which I have just mentioned, were added when billy pressed to change it. So they bob are fixed, but billy is added somehow . Also note that the final commit has not been re-added and that is where the main problem consists of.

It's a little better for an illustrator, I imagine this:

87e9a4e Add sectionGroup.html to templates_safelincs
bc0903f Add responsive skin to sectionProducts
7833850 Rewrite the way breadcrumbs are generated and output to the page
09d1318 Fix styles for video and featured product boxes, fix miscellaneous bugs and remove obselete code
13f0164 Fix section.html, add featured products, star buy products and product videos
01b3bfb Refine code for breadcrumbs
0303bae Modify getBreadcrumbTrail so that it attempts to take the correct route when recursing
1ae5f00 Rewrite the way breadcrumbs are generated and output to the page
2cc0525 Fix styles for video and featured product boxes, fix miscellaneous bugs and remove obselete code
cc3c86b Fix section.html, add featured products, star buy products and product videos

      

Can someone please explain what we are doing wrong here?

+3


source to share


2 answers


For completeness, I'll post the reason here.



Simply put, we were rewriting public history, which is bad . What we are doing now is rebasing from master only to our traits branch, and when it is updated with our own commits applied in the chapter, we then merge to master. In fact, we also started suppressing commits. Even if we can do the initial commit a few weeks ago.

0


source


I think this sequence will create the graph you see:



  • bob presses three commands not shown, name them a, b, c, parent cc3^

  • billy pull --rebase

    his work on them but decides not to push anything else
  • bob for some reason comes back and repeats those three commits, creating cc3

    , 2cc

    and 1ae

    as new a, b, c and continues with 030

    and 01b

    .
  • bob force - pushes this new story that diverges from billy in cc3^

  • billy now pull --rebase

    again. so that a, b, c and two more commits reset to 01b

    , receiving 13f

    , 09d

    , 783

    as its newly updated version of the original Bob's a, b, c and its own bc0

    and 87e

    .
0


source







All Articles