Understanding Git Charts

I am new to Git and need help understanding Git history graphs, i.e. The relationship between commits and merges, as they appear on the chart in tools such as SmartGit or GitGui. In the image below, what is the relationship between commits in red, in particular, "IA-481" and "Merge branch IA-481 (Release2) ...." I basically ask because "IA-481" had to go to branches called "IA-481 (Release2), and not in the" Master ".

So here is a little more detail:

  • I initially checked my files in a branch called "IA-481 (Release)".
  • Then I switched to “Master”, naming it “Merge” with the main branch to merge files with “IA-481 (Release)” using Master. I made a few more changes, but I realized that it was too soon to pass on to Teacher, so I did not dedicate Teacher.
  • Instead, I created and switched to another new branch called "IA-481 (Release2)), and I transferred the merged files to this second new branch (and not to the master).
  • Someone else switched to branch IA-481 (Release2) to test my work and did some checks.

Later we find out that bit IA-481, which I originally made for the branch "IA-481 (Release2)", somehow got into the main branch. and I'm trying to understand how this happened. Was it the “Merge IA-481 (Release2) Branch” command made by another person who joined her with the Master, or was she already in the Master with my IA-481 registration. Under what circumstances did things go wrong?

+4
source share
5 answers

IA-481 was a fixation on a branch separate from the lead. This branch was then merged with the master to commit the merge that you selected.

+1
source

Counts are pretty easy to interpret. The various commits are points, so if you just change something and make a commit, you will get another small point associated with the previous commit.

If you enter a branch, you can get some points related to the previous commit.

If you combine several previous commits, you can connect to your new point.

Thus, IA-481 was commit on a different branch than the main one (but it is sorted in chronological order, so it is displayed between IA-1617 and IA-1617, which were committed on the main server), and it merges into the main branch on the second highlighted below.

Your last highlighted point is another merge, but this time with a branch removed.

Anything else unclear?

0
source

Performs changes. When commits are made one after another in the same branch (normal case), the changes are summarized. When branches are created, changes made to one branch are not displayed in other branches. Merging is required to merge independent changes.

Consider the following simple story. Commits modify a single file. The contents of the file after each commit are displayed in double quotes. Commit 0 is the first commit, commits from 1 to 4, adds the English name of its commit number, and commit 5 combines the changes made using commits 3 and 4.

* commit 5: "one two three four" |\ Merge: 3 4 | | | | | * commit 4 "one two four" | | | | * | commit 3 "one two three" |/ | * commit 2: "one two" | | * commit 1: "one" | | * commit 0: "" 

Fiction 4 was made in another branch. This corresponds to fixation IA-481. Presumably, this commit made some changes to the commit "Union of IA-481 branch (Release2) ...." commit, these changes were integrated into the main branch. This is a common workflow when working on several things: a branch, committing changes, and then merging them into the main branch. Without merging, the changes just sit in a separate branch and do nothing.

0
source

Other answers seem long.

Merging with another branch leads to changes from this branch. You seem to think that you need to unite and then merge. This is not true - the merge itself is a commit that introduces changes from another branch.

Edit: @tom is correct. If there are merge conflicts, you must actively merge after you mark the conflicts as resolved.

0
source

Did you try what @gary said? I felt that there were a lot of comments that you might have missed, but this should help based on your question and comments.

Link to git log: git log manpage

 --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]] Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (ie regular file, symlink, submodule, …) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected. 

So this command will tell you the commit where the newAddedFile.c file was added.

git log --diff-filter = A - newAddedFile.c

0
source

Source: https://habr.com/ru/post/1478945/


All Articles