Skip to content

Instantly share code, notes, and snippets.

@heridev
Last active July 6, 2024 21:37
Show Gist options
  • Save heridev/244e75dbe2e21430b093d7c6ee4f8b4b to your computer and use it in GitHub Desktop.
Save heridev/244e75dbe2e21430b093d7c6ee4f8b4b to your computer and use it in GitHub Desktop.
git checkout master
git branch feature-one
git branch feature-two
git checkout feature-one
echo "Change in feature-one" >> file.txt
git add file.txt
git commit -m "Feature one: change in file.txt"
echo "This is feature-one.txt" > feature-one.txt
git add feature-one.txt
git commit -m "Add feature-one.txt"
git checkout feature-two
echo "Change in feature-two" >> file.txt
git add file.txt
git commit -m "Feature two: change in file.txt"
echo "This is feature-two.txt" > feature-two.txt
git add feature-two.txt
git commit -m "Add feature-two.txt"
git checkout master
git rebase feature-one
  • (HEAD -> master) Add feature-one.txt
  • Feature one: change in file.txt
  • Previous commits on master...
git rebase feature-two
# Edit file.txt to resolve the conflict
git add file.txt
git rebase --continue
  • (HEAD -> master) Add feature-two.txt
  • Feature two: change in file.txt
  • Add feature-one.txt
  • Feature one: change in file.txt
  • Previous commits on master...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment