Skip to content

Instantly share code, notes, and snippets.

@kentfredric
Created June 3, 2014 09:25
Show Gist options
  • Save kentfredric/6e06db0933e27e414e93 to your computer and use it in GitHub Desktop.
Save kentfredric/6e06db0933e27e414e93 to your computer and use it in GitHub Desktop.
$ mkdir a
$ cd a
a $ git init
a $ echo "one" >> file
a $ echo "two" >> file
a $ echo "three" >> file
a $ git add file
a $ git commit -m "Add file"
a $ cd ..
$ mkdir b
$ cd b
b $ git init
b $ echo whatever > file
b $ git add file
b $ git commit -m "First commit"
b $ echo 'whatever 2' > file
b $ git add file
b $ git commit -m "Second commit"
b $ echo 'whatever 3' > file
b $ git add file
b $ git commit -m "third commit"
b $ git subrepo clone ../a sub
git subrepo 'sub' cloned from '../a' (master)
b $ echo 'whatever 4' > file
b $ git add file
b $ git commit -m "fourth commit"
b $ git rebase -i HEAD~4
## Tell rebase to merge commit 3 into commit 2 ###
Successfully rebased and updated refs/heads/master.
b $ cd ../a
a $ vim file
### replace "two" with "two++"
a $ git add file
a $ git commit -m "Update file"
a $ cd ../b/
b $ git subrepo pull sub/
fatal: Needed a single revision
git subrepo 'sub' pulled from '../a' (master)
b $ git status
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
Changes to be committed:
modified: sub/.gitrepo
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: sub/file
b $ git diff
diff --cc sub/file
index 4cb29ea,e328750..0000000
--- a/sub/file
+++ b/sub/file
@@@ -1,3 -1,3 +1,7 @@@
one
++<<<<<<< HEAD
+two
++=======
+ two++
++>>>>>>> 40e94ce556a9a91d9fada79a7ebb4296a0c85e11
three
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment