Created
November 21, 2013 13:51
-
-
Save dkirrane/7581863 to your computer and use it in GitHub Desktop.
Gist to create a Git reppo and rename and modify a file on 2 different branches
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/sh | |
## | |
# Gist to create a Git reppo and rename and modify a file on 2 different branches | |
## | |
mkdir renameTest | |
cd renameTest | |
git init | |
# Init project | |
echo "base" > data.txt | |
git add -A | |
git commit -m "Initial project" | |
# Branch and rename file | |
git checkout -b myBranch | |
mv data.txt data-renamed.txt | |
git add -A | |
git commit -a -m "renamed" | |
# Make a change to renamed file | |
echo "remote" >> data-renamed.txt | |
git add -A | |
git commit -a -m "myBranch commit" | |
# Checkout master and make a change to original file | |
git checkout master | |
echo "local" >> data.txt | |
git commit -a -m "local" | |
# Merge | |
git merge myBranch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment