Git logarithmic discounts

I know that GIT rebases will rewrite history, i.e. commit identifiers will change. However, is there a way to track when a branch was reinstalled and from which branch?

EDIT: I have a development branch "A" and a theme branch "B". Team A splits the team. At some point, โ€œAโ€ was re-based on the main branch. As a result of the re-base (and subsequent commits), when I updated the topic branch, I saw discrepancies. I am trying to find the right person to talk to in order to solve problems.

+6
source share
3 answers

You can probably tell who did this! When you reinstall, as the commits are overwritten, the commit information will be from the person doing the rebase, not the original author. (This is separate from the authorโ€™s information.)

You can see this information in gitk (in the differences area in the lower left corner) or in the output of git log --pretty=fuller (as more complete than complete). Log output example:

 commit b8624718b97a39a04637c91ec3517c109f3f681d Author: Original Author < original@author.com > AuthorDate: Sun Aug 8 02:15:10 2010 -0300 Commit: New Committer < new@committer.com > CommitDate: Mon Jan 23 17:29:39 2012 -0800 a lovely commit message ... 

The name of the committer, email address, and date are the operation that actually wrote the commit. Please note that if it has been overwritten several times, you will have the latest information.

As for where it was reinstalled from ... if the original version of the reinstalled commits is also in your history, it's simple. Just search for the full history for the corresponding commit, for example, with a commit message snippet or something that has been changed in commit:

 git log --all --grep='commit subject from a rebased commit' git log --all -S'void this_function_was_added() {' 

If you no longer have an initial fixation in history, it will be tougher. I hope you can find out by tracking the person who did this, and if they donโ€™t know it, asking them to run git reflog show <branch> in their repository to view the history of this thread.

+8
source
 git reflog 

will allow you to view the history of the entire git workflow. In the project I'm working on, here are three main journal entries:

 151a1da HEAD@ {0}: filter-branch: rewrite db8c822 HEAD@ {1}: checkout: moving from fixes to master db8c822 HEAD@ {2}: checkout: moving from master to fixes 

The first column shows the SHAID. So you can use the standard git commands for this SHAID for example git show 151a1da

+5
source

Reflog is a logging mechanism for updating the tip of branches. This command is designed to manage the information recorded in it.

"Basically, every action performed inside Git where the data is stored, you can find it inside the reflog. Git really tries not to lose your data, so if for some reason you think, you can probably dig it out with Git reflog. This means that you can use it as a security net: you donโ€™t have to worry about merging, reloading or any other action destroying your work, as you can find it again using this command. "

Read more about this topic in

+2
source

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


All Articles