

# 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.
#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.
