What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi all! I have a issue regarding git: I did merge with master into my current branch. I did the reve

Posts: 38 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi all! I have a issue regarding git: I did merge with master into my current branch. I did the revert and know when I'm trying to do the merge again, doesn't work. What it is the best solution?

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited August 2019

    revert the revert, apply changes

  • Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    once you do the revert, old commit is still in the history so you cannot merge it again, two ways are:

    • revert the revert commit, and apply fixes
    • checkout the SHA BEFORE the commit, and force push, but I'm strongly against it unless you're the only developer
  • Posts: 38 πŸ§‘πŸ»β€πŸš€ - Cadet

    When I do 2 merge in my current branch and I want to revert just a branch?

  • Posts: 38 πŸ§‘πŸ»β€πŸš€ - Cadet

    I did from PhpStorm on the same commit

  • Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    you cannot "revert a branch" because when you merge things, you merge commit sets

  • Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    give me few minutes, let me check if I can come up with a simple example

  • Posts: 38 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok

  • Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    ok, so let me understand situation first:

    • you created a new_branch from master
    • you have changed things in new_branch
    • you have merged new_branch to master
    • you have found things are broken
    • you have reverted the merge commit from master (which created revert commit in master)
      is that correct?
  • Posts: 38 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited August 2019

    So, I have a branch created from master. Master was ahead with x commits and I did the merge, but when I did the merge, in IDE (PhpStorm) was selected and antoher branch, I want to remove all changes from that branch, but not master.

  • Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    ok, so if this is NOT server branch then all fine (i guess)

  • Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    simply checkout the SHA of the branch when it was still ok

  • Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    if you haven't pushed anything to remote, you can still do
    git checkout branch
    and
    git reset --hard origin/branch

  • Posts: 38 πŸ§‘πŸ»β€πŸš€ - Cadet

    I did merge: dev-something and master into test-branch
    I want to revert just dev-something from test-branch

Welcome!

It looks like you're new here. Sign in or register to get started.