Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 419639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:47:51+00:00 2026-05-12T18:47:51+00:00

Suppose I have this feature branch foo. Now I want to merge it back

  • 0

Suppose I have this feature branch “foo”. Now I want to merge it back into master, but I’ve added some debugging code that I don’t want in master.

The debug code is in it’s own commit, so I could use git cherry-pick on each commit and leave out this commit. But that’s gonna be quite tiresome.

Is there some “inverse cherry-pick” that does this, or an interactive merge?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:47:51+00:00Added an answer on May 12, 2026 at 6:47 pm

    Use interactive rebase:

    git rebase -i SHA-OF-FIRST-COMMIT-IN-BRANCH
    

    That will open something like this in your $EDITOR:

        pick 8ac4783 folders and folders
        pick cf8b1f5 minor refactor
        pick 762b37a Lots of improvement. Folders adn shit.
        pick 3fae6e1 Be ready to tableview
        pick b174dc0 replace folder collection view w/ table view
        pick ef1b65b more finish
        pick ecc407f responder chain and whatnot
        pick 080a847 play/pause video
        pick 6719000 wip: movie fader
        pick c5f2933 presentation window fade transition
    
        # Rebase e6f77c8..c5f2933 onto e6f77c8
        #
        # Commands:
        #  p, pick = use commit
        #  e, edit = use commit, but stop for amending
        #  s, squash = use commit, but meld into previous commit
        #
        # If you remove a line here THAT COMMIT WILL BE LOST.
        # However, if you remove everything, the rebase will be aborted.
        #
    

    So what you do is simply to remove the line containing the debug commit, write the file and close your editor, and git will tell you something along the lines of:

    Successfully rebased and updated refs/heads/master.
    

    Now you can just merge in that branch to master.

    UPDATE: It should be noted that altering history with rebase should only happen on private branches. If this branch has been exposed to the public, use git revert as proposed by other answerer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have this class: class MyClass(object): def uiFunc(self, MainWindow): self.attr1 = foo self.attr2
Suppose I have a function that performs some task (this is in Python pseudocode):
Suppose we have the following situation in Git: X---Y feature / A---B---C---D edge Now
Suppose I have a class like this: class Foo { std::vector<int> bar; public: std::vector<int>&
Suppose I have this table parent | child 1 2 1 3 2 4
Suppose I have this table: id | name | city ------------------ 1 | n1
Suppose I have this (C++ or maybe C) code: vector<int> my_vector; for (int i
Suppose I have this function: void my_test() { A a1 = A_factory_func(); A a2(A_factory_func());
Suppose I have this: <select id=myselect> <option rel=a>1</option> <option rel=b>2</option> <select> How do I
Suppose I have this image: <img src=images/01.jpg border=0 rel=shadow /> Then with jQuery, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.