Created
August 24, 2010 15:06
-
-
Save davertron/547701 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# Make a new git bare repo | |
mkdir repo | |
cd repo | |
git init --bare | |
cd .. | |
# Now clone the repo into two that refer to the original "remote" | |
git clone repo repo1 | |
git clone repo repo2 | |
cd repo1 | |
echo "First file\nThis is really sweet!\n" > a.txt | |
git add . | |
git commit -m "Created a" | |
git push origin master | |
cd ../repo2 | |
git pull | |
# Here's our change that will conflict | |
echo "First file\nThis is really awesome!\n" > a.txt | |
git add . | |
git commit -m "Changed 'sweet' to 'awesome'" | |
git push origin master | |
# Make a second commit just to try to "mask" the first one to | |
# see if that's what causes the issue | |
echo "Second file\nThis one is awesomer!\n" > b.txt | |
git add . | |
git commit -m "Added b" | |
git push origin master | |
cd ../repo1 | |
# Just change whitespace, which should cause a conflict, since | |
# that same line was changed over in repo2 | |
echo "First file\n This is really sweet!\n" > a.txt | |
git stash save "Want to pull new changes before adding my whitespace" | |
git pull | |
git stash apply | |
# I get a conflict here, which is GOOD, it means git is seeing the changes | |
# as conflicting, which is exactly what I would expect... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment