git_branch

This is an old revision of the document!


Some trickier operations involving branches.

  • bugfix: local branch, for personal use only
  • master: local tracking branch
  • origin/master: remote tracking branch (in your object store)
  • master on remote (upstream) machine: remote branch
$ git branch
  b1
  b2
  dev_pdev
  emergency
  failed
  fix
  flags
  kerneldoc
  makefile
* master
  mdio
  nb
  net_phy_kconfig
  of
  watchog
$
$ git branch -v
  b1              d36df409a353 branch b1
  b2              8ed29f15e876 Merge branch 'b1' into b2
  dev_pdev        c4c5cbc5de95 platform.c: standardize on drv/pdrv, dev/pdev names
  emergency       894025f24bd0 Merge tag 'usb-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
  failed          99bd7aaa5563 [PATCH] "failed" -> "fail" in some dts files
  fix             5d1d2d55459b second part of fix
  flags           051935978432 Merge branch 'for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
  kerneldoc       7201de85450d [PATCH] drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c: misspelled "dev"
  makefile        db5941a490b1 makefile
* master          3a5af36b6d0e Merge tag '4.19-rc3-smb3-cifs' of git://git.samba.org/sfrench/cifs-2.6
  mdio            1397529bc401 phy: Refactor include/uapi/linux/mdio.h
  nb              0b07194bb55e Linux 4.14-rc7
  net_phy_kconfig 2a93d87ebb56 aesthetic fixes to drivers/net/phy/Kconfig
  of              b4e0cbfd71d3 Remove all remaining tests and usages of "chosen@0".
  watchog         d2b752464917 watchdog: fix a small number of "watchog" typos in comments
$

Additionally, print the name of the upstream branch (if there is one):

$ git branch -v -v (or -vv)
... snip ...
* master          3a5af36b6d0e [origin/master] Merge tag '4.19-rc3-smb3-cifs' of git://git.samba.org/sfrench/cifs-2.6
... snip ...

What is merged (into current branch or specified branch):

$ git branch --merged
  emergency
  flags
* master
  nb
$
$ git branch --merged nb
  nb
$

What isn't merged:

$ git branch --no-merged
  b1
  b2
  dev_pdev
  failed
  fix
  kerneldoc
  makefile
  mdio
  net_phy_kconfig
  of
  watchog
$
  • git_branch.1537020898.txt.gz
  • Last modified: 2018/09/15 14:14
  • by rpjday