Skip to content

Instantly share code, notes, and snippets.

@timdream
Created January 4, 2012 02:37
Show Gist options
  • Select an option

  • Save timdream/1558175 to your computer and use it in GitHub Desktop.

Select an option

Save timdream/1558175 to your computer and use it in GitHub Desktop.
rebase fail
#!/bin/sh
cd /tmp
# init remote
mkdir remote.git
cd remote.git
git init --bare
# init local
cd ..
mkdir local
cd local
git init
# commit A
touch foo
git add foo
git commit -m 'First commit'
# commit B, on branch bar
git branch bar
git checkout bar
touch bar
git add bar
git commit -m 'Second commit'
# tree: A-B
git remote add origin ../remote.git
git push origin master
git push origin bar
# commit C, on master
git checkout master
touch blah
git add blah
git commit -m 'Third commit'
# tree: A-B
# \--C
git checkout bar
git rebase master # we are rebasing bar branch that is already on remote
# after rebase
# tree: A-C-B'
git push origin bar # fail
git push -f origin bar # will work, but other people will have problem pulling again :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment