It is git log
result before rebase
:
$ git log --branches --graph --oneline
* ea450cb (HEAD -> v1.0) combination lots of modifies..
* d602e25 nnew edit
| * 51bfb5f (master) abc added
|/
* 11e16ef animals gg
* 78e1630 (origin/master, origin/HEAD, brc) important backup file is forced to commit.
* 7a87267 nc.txt is ignored, anymore.
* 5def0f6 (tag: v2.0) local .ignre and test *.dat files.
* 1591c3a ignoreDir directory *.dat files are ignored.
* f84ad0d log add
* ac462c0 .gitignore test.
* 4d1e437 .gitignore file is added
* b3574db hüloo
* 3389e5c merge2
|\
| * bb64902 (origin/confl) Change line.
| * 14f7040 İnit for another conflict exercise.
* | ca51aef (tag: v1.0) Truth of line.
* | f4fcc04 Init for another conflict exercise.
|/
* 0f251b2 Merge branch 'octodog'
I want to change it like (only focus at last 3 commits):
$ git log --branches --graph --oneline
* 51bfb5f (master) abc added
* ea450cb (HEAD -> v1.0) combination lots of modifies..
* d602e25 nnew edit
* 11e16ef animals gg
* 78e1630 (origin/master, origin/HEAD, brc) important backup file is forced to commit.
* 7a87267 nc.txt is ignored, anymore.
* 5def0f6 (tag: v2.0) local .ignre and test *.dat files.
* 1591c3a ignoreDir directory *.dat files are ignored.
* f84ad0d log add
* ac462c0 .gitignore test.
* 4d1e437 .gitignore file is added
* b3574db hüloo
* 3389e5c merge2
|\
| * bb64902 (origin/confl) Change line.
| * 14f7040 İnit for another conflict exercise.
* | ca51aef (tag: v1.0) Truth of line.
* | f4fcc04 Init for another conflict exercise.
|/
* 0f251b2 Merge branch 'octodog'
But when i done:
$ git checkout master
$ git rebase v1.0
It turned to:
$ git log --branches --graph --oneline
* 8c4a1e6 (HEAD -> master) abc added
* 22b75db animals gg
* 6f88917 important backup file is forced to commit.
* 69ef5c8 nc.txt is ignored, anymore.
* 36a270d local .ignre and test *.dat files.
* 55e7afd ignoreDir directory *.dat files are ignored.
* aac484c log add
* 5d13b95 .gitignore test.
* 51cf1e9 .gitignore file is added
* d1d37cd hüloo
| * ea450cb (v1.0) combination lots of modifies..
| * d602e25 nnew edit
| * 11e16ef animals gg
| * 78e1630 (origin/master, origin/HEAD, brc) important backup file is forced to commit.
| * 7a87267 nc.txt is ignored, anymore.
| * 5def0f6 (tag: v2.0) local .ignre and test *.dat files.
| * 1591c3a ignoreDir directory *.dat files are ignored.
| * f84ad0d log add
| * ac462c0 .gitignore test.
| * 4d1e437 .gitignore file is added
| * b3574db hüloo
| * 3389e5c merge2
| |\
|/ /
| * bb64902 (origin/confl) Change line.
| * 14f7040 İnit for another conflict exercise.
* | ca51aef (tag: v1.0) Truth of line.
* | f4fcc04 Init for another conflict exercise.
|/
* 0f251b2 Merge branch 'octodog'
As you see from 3389e5c merge2
to 11e16ef animals gg
, it applied commits twice.
Why it is not working as i expect? What's the way of my goal?
You have two things called v1.0
.
One is your current branch:
* ea450cb (HEAD -> v1.0) combination lots of modifies..
and the other is a tag:
* | ca51aef (tag: v1.0) Truth of line.
When you ask Git about v1.0
, it will usually choose the tag, which in this case means commit ca51aef
. This is the case for git rebase
.
(The git checkout
command will choose the branch instead.)
To make what you want to happen, actually happen, you have several choices:
git rebase ea450cb
git rebase heads/v1.0
or git rebase refs/heads/v1.0
v1.0
is not a good branch name but is a good tag name, so keep the tag, and change the branch name.