reflog: git rebase <upstream> <branch> vs git checkout <branch> && git rebase <upstream>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Git community.

I have a question about reflog and "git-rebase(1) Manual Page".
As the man reads
------------------------- cut here -----------------------
git rebase [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]
            [<upstream> [<branch>]]

...
If <branch> is specified, git rebase will perform an automatic git checkout <branch>
before doing anything else. Otherwise it remains on the current branch.
------------------------- cut here -----------------------

So I think that
  git rebase master b1
is the same as
  git checkout b1 && git rebase master
but in the reflog I see that the 'git rebase master b1' does not write 'git checkout b1'
into the reflog.

The question is - why there is no records in the reflog about ' automatic git checkout <branch>'?
Or maybe git's man page is not accurate about this step?

Here is my test:
------------------------- cut here -----------------------
mkdir git_rebase
cd git_rebase/
git init
echo "master 1" > file.txt
git add file.txt
git commit -m "master 1"
git checkout -b "b1"
echo "branch b1" > file_b1.txt
git add file_b1.txt
git commit -m "b1 1"
git checkout master
echo "master 2" >> file.txt
cat file.txt
git add file.txt
git commit -m "master 2"

# make a copy of repo directory (tar -cf ../repo_dir.tar .)
tar -cf ../git_rebase.tar .

# git rebase <upstream> <branch>
git reflog
git rebase master b1
git reflog

# restore the repo
cd ..
rm -Rf git_rebase
mkdir git_rebase && cd git_rebase && tar -xf ../git_rebase.tar

# git checkout <branch> && git rebase <upstream>
git reflog
git checkout b1 && git rebase master
git reflog
------------------------- cut here -----------------------

# In the case 'git rebase master b1'
# 'git reflog' shows
cac9cc7 (HEAD -> b1) HEAD@{0}: rebase finished: returning to refs/heads/b1
cac9cc7 (HEAD -> b1) HEAD@{1}: rebase: b1 1
29c7386 (master) HEAD@{2}: rebase: checkout master
29c7386 (master) HEAD@{3}: commit: master 2
5cb30a2 HEAD@{4}: checkout: moving from b1 to master
e75c314 HEAD@{5}: commit: b1 1
5cb30a2 HEAD@{6}: checkout: moving from master to b1
5cb30a2 HEAD@{7}: commit (initial): master 1

# In the case ' git checkout b1 && git rebase master '
c08d270 (HEAD -> b1) HEAD@{0}: rebase finished: returning to refs/heads/b1
c08d270 (HEAD -> b1) HEAD@{1}: rebase: b1 1
29c7386 (master) HEAD@{2}: rebase: checkout master
e75c314 HEAD@{3}: checkout: moving from master to b1 /* This line is absent in case of 'git rebase master b1' */
29c7386 (master) HEAD@{4}: commit: master 2
5cb30a2 HEAD@{5}: checkout: moving from b1 to master
e75c314 HEAD@{6}: commit: b1 1
5cb30a2 HEAD@{7}: checkout: moving from master to b1
5cb30a2 HEAD@{8}: commit (initial): master 1


Best regards and many thanks for your work.
Evgeny.

________________________________

This e-mail and any attachment(s) are intended only for the recipient(s) named above and others who have been specifically authorized to receive them. They may contain confidential information. If you are not the intended recipient, please do not read this email or its attachment(s). Furthermore, you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this e-mail and then delete this e-mail and any attachment(s) or copies thereof from your system. Thank you.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux