Skip to content

Instantly share code, notes, and snippets.

@chalstrick
Created November 28, 2013 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chalstrick/7694959 to your computer and use it in GitHub Desktop.
Save chalstrick/7694959 to your computer and use it in GitHub Desktop.
shell script to show how native git handles certain file/folder conflicts during checkout
#!/bin/sh
set -x
# create the setup: first commit has x/y and second commit only x
git init
mkdir x
echo foo > x/y
git add x/y
git commit -m "add x/y"
git tag H
git rm -r x
echo bar > x
git add x
git commit -m "add x"
git tag M
# test5
git reset --hard H
git rm -r x
echo bar > x
git add x
git checkout M
git status
# test5b
git checkout master
git reset --hard H
git rm -r x
echo anotherBar > x
git add x
git checkout M
git status
# test6
git checkout master
git reset --hard H
git rm -r x
echo bar > x
git add x
echo anotherBar > x
git checkout M
git status
# test6b
git checkout master
git reset --hard H
git rm -r x
echo anotherBar > x
git add x
echo differentBar > x
git checkout M
git status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment