Skip to content
Phil Burk edited this page Oct 21, 2019 · 4 revisions

Cloning the Repository and Making a Change

My goal today was to check out the repository from GutHub, edit the readme.txt and merge the changes.

mkdir pforth
cd pforth
git init
git clone https://github.com/philburk/pforth.git

This created another directory called "pforth" inside my "pforth" directory.

I made a branch for the change and then edited my file.

cd pforth
git checkout -b fix-readme
vi readme.txt

I then staged my changes, commited my change with a sign-off, and pushed the changes to GitHub.

git add .
git commit -s
git push origin fix-readme

I noticed that I needed to make another small change, so I used 'git commit --amend', a mistake in hindsight.

vi readme.txt
git add .
git commit --amend     ;; wrong!!!
git push origin fix-readme

The push failed saying I was not in sync with the repository. I had to rebase my changes and then do a merge by hand.

git pull --rebase origin fix-readme
vi readme.txt
git add .
git rebase --continue

I was then able to push my change.

git push origin fix-readme

Then using the GitHub UI I was able to review the diff, request a merge and merge my changes back into master.

Rather than use --amend, it is better to always make a new commit after pushing one commit to the origin.