Git: How to find when a commit was merged into master?












2














I want to create a metric in my project that measures how long does a commit take from its creation till to get into the master branch?



Is it possible? It looks like for fast-forwarded commits I can't get this info from the git log.



If I can get a snapshot of the repository X days ago, maybe I can calculate it. Another option is to get a log that registers when a branch HEAD was modified.



Update: If you create an annotated tag at each release, you can just see the date of the tag that included the commit. Here is how to list the commits included in a tag










share|improve this question
























  • using git show --pretty=fuller SHA1 you could look at author date and commit date; BTW when using gerrit, a commit-id is added to track commits between branches, could maybe be done the same way in your project
    – OznOg
    Nov 21 '18 at 18:43










  • See this helps: stackoverflow.com/questions/10585874/… and stackoverflow.com/questions/42897660/…
    – Rishabh Agarwal
    Nov 21 '18 at 18:54
















2














I want to create a metric in my project that measures how long does a commit take from its creation till to get into the master branch?



Is it possible? It looks like for fast-forwarded commits I can't get this info from the git log.



If I can get a snapshot of the repository X days ago, maybe I can calculate it. Another option is to get a log that registers when a branch HEAD was modified.



Update: If you create an annotated tag at each release, you can just see the date of the tag that included the commit. Here is how to list the commits included in a tag










share|improve this question
























  • using git show --pretty=fuller SHA1 you could look at author date and commit date; BTW when using gerrit, a commit-id is added to track commits between branches, could maybe be done the same way in your project
    – OznOg
    Nov 21 '18 at 18:43










  • See this helps: stackoverflow.com/questions/10585874/… and stackoverflow.com/questions/42897660/…
    – Rishabh Agarwal
    Nov 21 '18 at 18:54














2












2








2


2





I want to create a metric in my project that measures how long does a commit take from its creation till to get into the master branch?



Is it possible? It looks like for fast-forwarded commits I can't get this info from the git log.



If I can get a snapshot of the repository X days ago, maybe I can calculate it. Another option is to get a log that registers when a branch HEAD was modified.



Update: If you create an annotated tag at each release, you can just see the date of the tag that included the commit. Here is how to list the commits included in a tag










share|improve this question















I want to create a metric in my project that measures how long does a commit take from its creation till to get into the master branch?



Is it possible? It looks like for fast-forwarded commits I can't get this info from the git log.



If I can get a snapshot of the repository X days ago, maybe I can calculate it. Another option is to get a log that registers when a branch HEAD was modified.



Update: If you create an annotated tag at each release, you can just see the date of the tag that included the commit. Here is how to list the commits included in a tag







git git-log






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 14:37







neves

















asked Nov 21 '18 at 18:26









nevesneves

8,601106590




8,601106590












  • using git show --pretty=fuller SHA1 you could look at author date and commit date; BTW when using gerrit, a commit-id is added to track commits between branches, could maybe be done the same way in your project
    – OznOg
    Nov 21 '18 at 18:43










  • See this helps: stackoverflow.com/questions/10585874/… and stackoverflow.com/questions/42897660/…
    – Rishabh Agarwal
    Nov 21 '18 at 18:54


















  • using git show --pretty=fuller SHA1 you could look at author date and commit date; BTW when using gerrit, a commit-id is added to track commits between branches, could maybe be done the same way in your project
    – OznOg
    Nov 21 '18 at 18:43










  • See this helps: stackoverflow.com/questions/10585874/… and stackoverflow.com/questions/42897660/…
    – Rishabh Agarwal
    Nov 21 '18 at 18:54
















using git show --pretty=fuller SHA1 you could look at author date and commit date; BTW when using gerrit, a commit-id is added to track commits between branches, could maybe be done the same way in your project
– OznOg
Nov 21 '18 at 18:43




using git show --pretty=fuller SHA1 you could look at author date and commit date; BTW when using gerrit, a commit-id is added to track commits between branches, could maybe be done the same way in your project
– OznOg
Nov 21 '18 at 18:43












See this helps: stackoverflow.com/questions/10585874/… and stackoverflow.com/questions/42897660/…
– Rishabh Agarwal
Nov 21 '18 at 18:54




See this helps: stackoverflow.com/questions/10585874/… and stackoverflow.com/questions/42897660/…
– Rishabh Agarwal
Nov 21 '18 at 18:54












1 Answer
1






active

oldest

votes


















0














It is not easy, considering the commit itself does not know in which branch it is.

It does not keep track of branch "events" which would mention it was created in branch X, and then merge (possibly fast-forward) in branch Y.



Only git reflog registers HEAD changes, but it is limited in time.



As mentioned by the OP, you need to add a metadata (like an annotated tag, but you could also consider a git notes) in order to memorize the information you need.






share|improve this answer























  • Since there is no permanent register of changing the read of a branch, the really feasible solution is to create an annotated tag, and see the commits in between
    – neves
    Nov 22 '18 at 14:39












  • @neves I afre, and have included your comment in the answer for more visibility.
    – VonC
    Nov 22 '18 at 16:52











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418390%2fgit-how-to-find-when-a-commit-was-merged-into-master%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














It is not easy, considering the commit itself does not know in which branch it is.

It does not keep track of branch "events" which would mention it was created in branch X, and then merge (possibly fast-forward) in branch Y.



Only git reflog registers HEAD changes, but it is limited in time.



As mentioned by the OP, you need to add a metadata (like an annotated tag, but you could also consider a git notes) in order to memorize the information you need.






share|improve this answer























  • Since there is no permanent register of changing the read of a branch, the really feasible solution is to create an annotated tag, and see the commits in between
    – neves
    Nov 22 '18 at 14:39












  • @neves I afre, and have included your comment in the answer for more visibility.
    – VonC
    Nov 22 '18 at 16:52
















0














It is not easy, considering the commit itself does not know in which branch it is.

It does not keep track of branch "events" which would mention it was created in branch X, and then merge (possibly fast-forward) in branch Y.



Only git reflog registers HEAD changes, but it is limited in time.



As mentioned by the OP, you need to add a metadata (like an annotated tag, but you could also consider a git notes) in order to memorize the information you need.






share|improve this answer























  • Since there is no permanent register of changing the read of a branch, the really feasible solution is to create an annotated tag, and see the commits in between
    – neves
    Nov 22 '18 at 14:39












  • @neves I afre, and have included your comment in the answer for more visibility.
    – VonC
    Nov 22 '18 at 16:52














0












0








0






It is not easy, considering the commit itself does not know in which branch it is.

It does not keep track of branch "events" which would mention it was created in branch X, and then merge (possibly fast-forward) in branch Y.



Only git reflog registers HEAD changes, but it is limited in time.



As mentioned by the OP, you need to add a metadata (like an annotated tag, but you could also consider a git notes) in order to memorize the information you need.






share|improve this answer














It is not easy, considering the commit itself does not know in which branch it is.

It does not keep track of branch "events" which would mention it was created in branch X, and then merge (possibly fast-forward) in branch Y.



Only git reflog registers HEAD changes, but it is limited in time.



As mentioned by the OP, you need to add a metadata (like an annotated tag, but you could also consider a git notes) in order to memorize the information you need.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 22 '18 at 16:51

























answered Nov 21 '18 at 18:41









VonCVonC

832k29026183161




832k29026183161












  • Since there is no permanent register of changing the read of a branch, the really feasible solution is to create an annotated tag, and see the commits in between
    – neves
    Nov 22 '18 at 14:39












  • @neves I afre, and have included your comment in the answer for more visibility.
    – VonC
    Nov 22 '18 at 16:52


















  • Since there is no permanent register of changing the read of a branch, the really feasible solution is to create an annotated tag, and see the commits in between
    – neves
    Nov 22 '18 at 14:39












  • @neves I afre, and have included your comment in the answer for more visibility.
    – VonC
    Nov 22 '18 at 16:52
















Since there is no permanent register of changing the read of a branch, the really feasible solution is to create an annotated tag, and see the commits in between
– neves
Nov 22 '18 at 14:39






Since there is no permanent register of changing the read of a branch, the really feasible solution is to create an annotated tag, and see the commits in between
– neves
Nov 22 '18 at 14:39














@neves I afre, and have included your comment in the answer for more visibility.
– VonC
Nov 22 '18 at 16:52




@neves I afre, and have included your comment in the answer for more visibility.
– VonC
Nov 22 '18 at 16:52


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418390%2fgit-how-to-find-when-a-commit-was-merged-into-master%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python