I am new to the idea of git rebase
, but I understand the purpose of it. Essentially if you are working on a feature branch new
, and you want all the changes made to master
reflected in your local branch, then git rebase
is the way to go.
So I created my repo, with the general master branch.
I modified the README.md
file and added one line. I committed and pushed.
Then I created a new branch called new
.
Here I added two random files a
and b
, committed, and pushed.
Now I switched back to my master, and added another line to the README.md
file. I committed and pushed.
So now, README.md
on master
looks like this:
line 1 data
line 2 data
On new
, README.md
looks like this:
line 1 data
and so in order to get it updated with master's README, I perform git rebase origin/master
from the new
branch.
Then git "rewinds" my work, and puts it on top of the line 2 data
commit.
Now if I vim README.me
, I see the same file as master
.
What I want to happen now is I continue working on new
, and nothing of a merge commit arises (image 2). What actually ends up happening is that git status
says origin/new have diverged ... you have x and y different commits each ... use git pull
.
I use git pull
, and then a merge commit appears, which I must later push (image 1).
I don't want this "merge commit" because then the workflow looks like image 1 instead of image 2. How can I fix this?