Skip to content

Instantly share code, notes, and snippets.

@karronoli
Created February 22, 2020 12:38
Show Gist options
  • Save karronoli/fa29a9cf4a66479ea27bf47776fb71f1 to your computer and use it in GitHub Desktop.
Save karronoli/fa29a9cf4a66479ea27bf47776fb71f1 to your computer and use it in GitHub Desktop.
git fetch . feature/hello:master
$ git init /tmp/fetch_test
Initialized empty Git repository in /tmp/fetch_test/.git/
$ pushd /tmp/fetch_test
/tmp/fetch_test ~
$ git commit --allow-empty -m initial
[master (root-commit) 128b0b3] initial
$ git checkout -b feature/hello
Switched to a new branch 'feature/hello'
$ git commit --allow-empty -m hello
[feature/hello 94f1307] hello
$ git checkout -b feature/world master
Switched to a new branch 'feature/world'
$ git commit --allow-empty -m world
[feature/world c76ffcd] world
$ git log --pretty=oneline --abbrev-commit master
128b0b3 (master) initial
$ git fetch . feature/hello:master
From .
128b0b3..94f1307 feature/hello -> master
$ git log --pretty=oneline --abbrev-commit master
94f1307 (master, feature/hello) hello
128b0b3 initial
$ git log --pretty=oneline --abbrev-commit
c76ffcd (HEAD -> feature/world) world
128b0b3 initial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment