linerresources.blogg.se

Git list branches by creation date
Git list branches by creation date




git list branches by creation date
  1. #Git list branches by creation date how to
  2. #Git list branches by creation date code

# This branch will now contain the changes which you originally reverted, Git revert COMMIT_SHA_HASH_YOU_JUST_COPIED # Revert the commit where you reverted the changes. # You'll use this commit SHA hash which you've copied in the next command. # you created when you reverted the changes e.g. # You need to look at your git log and copy the SHA hash for the commit that # This is where you're going to bring back the changes which were reverted. # Make sure your local main branch is up-to-date.

#Git list branches by creation date code

The following commands assume you’re in a situation where your main branch has had feature-branch merged in, and that the code changes introduced by that merge have then been reverted. Ok, now for the good stuff: the git commands which will restore order to the universe and let you get on with your life. Huh?! Let’s head to the command line and see what that looks like. To bring the changes back in to main which you reverted, as well as any bug fix, you need to create a fresh branch and revert the commit which reverted the changes. This will give you all branch heads that are older than your given date.The reason that the code changes made before the bug fix are "missing" from main when you try to merge feature-branch in again is because the commits containing those changes were already merged in to main earlier.

  • -decorate: display all tag and branch names associated, just in case.
  • -no-walk: only list the very first commit for each branch, don't walk back the history.
  • : only list commits older than the date given
  • -remotes: start with any and all remote branches (substitute -branches for local branches).
  • You can read up the details on, but in short, it means So a working command would be: git log -remotes -before -no-walk -decorate The object type that has dates associated with it are commits, in git. It has no date information or anything else. git/refs which only has its file name (which is the branch name) and the hash of the tip/head commit. It is, by definition, and literally, only a simple text file in. You have to recall that a branch in git is nothing "physical". I believe this is what the OP actually wanted (as opposed to the title he chose for the question), as this would lead to good candidates for deletion.

    #Git list branches by creation date how to

    Note: this answer shows how to find branches that have been *updated* a long time ago, not branches that have been *created* (i.e., spliced off of some parent) a long time ago. This post was found, but this is not an option as it removes branches without checking the age. points-at print only branches of the object no-merged print only branches that are not merged merged print only branches that are merged f, -force force creation, move/rename, deletion edit-description edit the description for the branch l, -create-reflog create the branch's reflog M move/rename a branch, even if target exists m, -move move/rename a branch and its reflog a, -all list both remote-tracking and local branches contains print only branches that contain the commit r, -remotes act on remote-tracking branches t, -track set up tracking mode (see git-pull(1)) q, -quiet suppress informational messages v, -verbose show hash and subject, give twice for upstream branch Running git branch -h will probably indicate what to run to check when a branch has been created. The aim is to remove branches that are older than X weeks. The number of branches is growing and growing.






    Git list branches by creation date