Created
December 7, 2011 10:45
-
-
Save chilversc/1442357 to your computer and use it in GitHub Desktop.
Problem merging changes to file that was renamed
This file contains hidden or 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/sh | |
| # Create empty repository for testing | |
| mkdir cherrypick | |
| cd cherrypick | |
| git init | |
| # Simulate some initial work | |
| echo bob > a.txt | |
| git add a.txt | |
| git commit -m "bob" | |
| # Simulate performing a spike to test something out | |
| git checkout -b other | |
| mkdir foo | |
| mv a.txt foo/ | |
| echo jim > foo/a.txt | |
| git add -A | |
| git commit -m "jim" | |
| # Simulate doing some other work on the master | |
| # This work includes part of the change made by the spike | |
| # Including the rename of a.txt => foo/a.txt | |
| git checkout master | |
| mkdir foo | |
| mv a.txt foo/ | |
| git add -A | |
| git commit -m "move a.txt" | |
| # Try to merge the spike in to incorporate the changes to foo/a.txt | |
| git merge --no-commit --squash other |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment