2
I cloned a remote repository and soon after that I had to pull some files from a specific branch and it looks like it was merged (unintentionally) into the master itself, then created a new branch (apart from master) with the command git checkout -b nova_branch
, I made some modifications and then gave a push
from that new branch to the remote repository (it didn’t exist remotely), and it happened that in addition to my work it was also
sent the branch history I had done given a pull
(which improper merge occurred), just that I didn’t want it to happen, how can I remove this branch that shouldn’t have been "shit" and remove it from the history/log, both local and remote, but keep the modifications of the last commits?
the log is like this:
69ddf1d09a108a5989a67e955273853c (HEAD) -> mais recente (commit com as modificações corretas)
3a39b68b00aaf809165adae9a5897f86 -> correções corrretas
c6d496b50e63c91cb40b970b568803a9 -> correções corretas
1da606decbfc2832a91af185dc0013c9 (master) -> commit "errado", o qual foi puxado de uma branch remota e que quero excluir da história/log.
I thought I’d use the reset --soft 1da606decbfc2832a91af185dc0013c9
, that would be a good solution?
EDIT:
For better example, follow github image: circled in red are the histories that came from the branch I merged unintentionally and I want to remove.
What does that mean at the end of the hash?
– Thiago
showed the commit list with "pick", but didn’t show the "merge" commit, is that right? , in this case, only displayed the 3 correct commits as I said above
– Thiago
is to refer to the first parent of the 1da606 commit. In general terms, the idea is to connect your branch directly to the main parent commit of the merge commit.
– user148747
It should display the merge commit and you delete the line. You used the ^?
– user148747
I didn’t know, I thought it was an abbreviation for not writing the whole hash, gave a conflict, had to settle with reset, but thanks
– Thiago