When I did this I was a git / github novice trying to make a trivial change and submit a pull request. With a bit of help I succeeded, so anyone should be able to follow me. This FAQ explains what I did.
I already have an account on github configured with ssh keys etc and have been using it to clone the maidsafe C++ repo to my Linux PC and build it, and recently also cloning dirvine’s Rust crates and building those. The latter is what I’m trying to get my name in…
Here is what I did so far, following the instructions at https://help.github.com/articles/fork-a-repo/
In firefox visit https://github.com/dirvine/self_encryption
Grab URL of the fork: https://github.com/theWebalyst/self_encryption
Switch to Linux terminal:
$ cd ~/src/forks $ git clone https://github.com/theWebalyst/self_encryption
Sync with the original repo…
$ cd self_encryption # Show current sync.. $ git remote -v # Sync with source of fork.. git remote add upstream https://github.com/dirvine/self_encryption # Verify $ git remote -v
To sync with the master repo (see: https://help.github.com/articles/syncing-a-fork/)
$ git fetch upstream $ git checkout master $ git merge upstream/master
I made a change to src/self_encryption.rs and tried to commit
$ git commit` On branch master Your branch is ahead of 'origin/master' by 45 commits. (use "git push" to publish your local commits) Changes not staged for commit: modified: src/lib.rs no changes added to commit
I stopped at this point because of the output above. Looks like I’m not set up correctly. I thought it a bit odd that when I did the
git fetch upstream it appeared to grab and merge lots of changes when I wasn’t expecting any. Maybe that’s where I messed up? I was following the instructions from this: https://help.github.com/articles/fork-a-repo/
@dirvine any hints!?
David says they just made a load of changes, so I am ok and have ended up with my clone ahead of my git repo, so to push my clone to the repo…
Push local back to my repo
$ git push Username for 'https://github.com': theWebalyst Password for 'https://theWebalyst@github.com': Counting objects: 154, done. Delta compression using up to 8 threads. Compressing objects: 100% (72/72), done. Writing objects: 100% (154/154), 31.69 KiB | 0 bytes/s, done. Total 154 (delta 83), reused 139 (delta 68) To https://github.com/theWebalyst/self_encryption 7c9fca4..ef83646 master -> master
$ git commit On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: modified: src/lib.rs no changes added to commit
Oops! I need to “stage” before “commit”, so do either
git add ; git commit -m "commentary"
$ git commit -am "test change - added a comment" [master 8a48db8] test change - added a comment 1 file changed, 3 insertions(+)
Push to my repo…
$ git push Username for 'https://github.com': theWebalyst Password for 'https://theWebalyst@github.com': Counting objects: 4, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 497 bytes | 0 bytes/s, done. Total 4 (delta 3), reused 0 (delta 0) To https://github.com/theWebalyst/self_encryption ef83646..8a48db8 master -> master
Woo hoo! Now to create the pull request…
In firefox visit my repo at: https://github.com/theWebalyst/self_encryption
In the “Branch” menu, choose the branch that contains your commits.
To the left of the “Branch” menu, click the green Compare and Review button.
The Compare page will automatically select the base and compare branches; to change these, click Edit.
On the Compare page, click Create pull request.
Type a title and description for your pull request.
Click Create pull request.