Skip to content

Instantly share code, notes, and snippets.

@kaleocheng
Created September 18, 2017 08:13
Show Gist options
  • Save kaleocheng/e41119e317bdbcf192d108d2a3efbad2 to your computer and use it in GitHub Desktop.
Save kaleocheng/e41119e317bdbcf192d108d2a3efbad2 to your computer and use it in GitHub Desktop.
# Add init repo
mkdir hello
cd hello
git init
echo "Hello World" > README.md
git add . && git commit -m "Add README.md"
# Add empty vendor dir
git checkout --orphan vendor
git reset --hard
git commit --allow-empty -m "Initializing vendor "
git push origin vendor
git checkout master
# Add worktree
git worktree add -B vendor vendor origin/vendor
# Done, you can commit in two branches separately
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment