0

On a project, I made some modifications to my repo on github directly, and I forgot to pull on my local repo. when I pushed, I got something like this :

image of my commits

How can I have only one nice branche ?

I tried nothing because I don't wan't things to get worse And I want to obtain something like

A ----- B ----- C ----- D ----- E ----- F ----- G

knittl
  • 246,190
  • 53
  • 318
  • 364
  • 1
    If you forgot to pull (= fetch + merge) and you try to push to the same branch, you will get an error. The image you have shown happens when you pull (= fetch + merge) – knittl Nov 19 '22 at 20:28
  • Rebase interactively, pick all commits, force push with lease. And then configure your Git to rebase on pull. Try searching. – CodeCaster Nov 19 '22 at 20:30
  • 2
    What you have now is probably just a cosmetic problem. I wouldn't stress much about trying to replace it with a purely linear history. – chepner Nov 19 '22 at 20:35
  • the graph above, prove that, you merged from remote 2 times. you should read more about the difference between git merge and git rebase ( ie [here](https://www.atlassian.com/git/tutorials/merging-vs-rebasing) ). In general, you use git rebase, whenever git pull, history will linear like you want – Manh Do Nov 20 '22 at 14:02

0 Answers0