Simple Git - bootstraponline/meta GitHub Wiki

Visit the upstream repo and make a fork.

git clone --recursive [email protected]:USERNAME/test.git

cd test

git remote show origin

Created file in upstream, git pull syncs only with your fork.

git pull

git remote add up https://github.com/tmp-/test.git

This will rebase your local master branch onto the upstream master branch

git pull --rebase up master

Make a change in our local readme and commit.

echo "A test repository2" > readme.md
git add .
git commit -am "2"

Now we're ahead of our fork by one commit.

git status
git log

Let's create a conflict before pushing. Add a number to the readme in our fork on GitHub.

"A test repository1"

Now we'll rebase our local repo against our fork

git pull --rebase

Type git status to see both modified:

README.md

open readme.md

HEAD = what's on GitHub (your local fork) 2 = your local commit

Select the local version (2) and delete the rest.

<<<<<<< HEAD
A test repository1
=======
A test repository2
>>>>>>> 2

becomes

A test repository2

Now add the change

git add .
git status

Now continue rebase.

git rebase --continue

Now git push will work.

git push