No announcement yet.

add tag but exclude merged commits

  • Filter
  • Time
  • Show
Clear All
new posts

  • add tag but exclude merged commits

    Using git repos, git bash shell for interaction; using BitBucket for Code Reviews and Merging, creating Branches, etc.

    We'd like to create a Service Pack 'Tag', but there are Commits that have been Merged we don't want included in the Service Pack (one Commit/Merge we want to completely remove). We have considered using 'git revert' to move the undesired Commits to the top, but feel that will not get us the desired effect (not sure of the side-effects). We have also considered a 'git reset', but unclear what would be "lost".

    The screenshot shows what we want: remove 'commit-a' (has broken code), and want the SP Tag to include 'commit-b' and 'commit-f' but not the others. Any suggestions how to accomplish this?

  • #2
    Wish that screenshot came through clearer.

    1. Create a new branch off of the commit just before the one you don't like.
    2. Cherry-pick commit-b. Commit.
    3. Cherry-pick commit-f. Commit.
    4. Create the tag off of the latest in that new branch.
    5. Ship off the new branch.