UPDATE: example repository, https://github.com/so-gitdemo/so-gitdemorepo
In the context of the github repo. How can I easily locate rev "b0430cee"? I know I can just look, but the real example that this repository mimics has a dozen committers and multiple other branches. Not quite as easy to use inspection.
How can I find the branch creation revision when the branch has been merged multiple times?
I am aware of this question: How to determine when a Git branch was created?
The solution does not appear to work for a branch that has been merged multiple times. We typically merge bug fixes back from the release branch to the main branch. Maybe we're even doing this part wrong ... still new to git.
Imagine the following simple. The real thing has MANY more commits on master/branch from multiple people. There are also several release branches (think 1.0, 1.1, 1.2, 1.3)
Future dev ?
|
|
Merge 1.0 back * ? Potential future fixes
|\ |
| \|
| \
New work * |
| * Emergency bug fix
| |
Merge 1.0 back * |
|\ |
| \|
| * Another bug fix
| |
| |
New feature * * First bugfix on branch 1.0
| /
| /
|/
* Feature
|
|
|
* Some feature
|
|
|
* The past (master)
We're still new to git and working out the best way to manage releases and branches and we've decided that we need to retroactively add some tags to the repo. Such as a 1.0 tag for the beginnning of the 1.0 branch and later 1.0.1 tags to bugfix releases.
Follow-up bonus question: What is the best way to add the tags that I want? and at which revision should I tag? first commit on new branch? or first common commit before branch commit?
Search the reflogs If you're not working in the repository where the commit was made, the best you can do in this case is examine the reflogs and find when the commit was first introduced to your repository; with any luck, you fetched the branch it was committed to.
Click History. On the History tab, click the commit you'd like to review. If there are multiple files in the commit, click on an individual file to see the changes made to that file in that commit.
Since you added a git repo... I worked remotely to get things tested.
How can I easily locate rev "b0430cee"?
In that case, this pretty oneliner did the job for me:
git rev-list --reverse --topo-order --left-right --boundary 1.0...master |
grep "^>" -B1 |
head -1 |
cut -c2-
If you wanted to get 469c14a1fa8a40237700 (New feature work
) instead, this works for me:
git rev-list --reverse --topo-order --left-right --boundary 1.0...master |
grep "^>" |
head -1 |
cut -c2-
HTH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With