http://github.com/guides/keeping-a-git-fork-in-sync-with-the-forked-repo
Generally it's a bad idea to work in the master branch. In git, master is the equivalent of CVS's HEAD, but branches are really easy to use and merge back into the HEAD branch. Also, because git is distributed, it's an easier workflow to keep the master branch (or whatever branches you share with the upstream repo) 'clean' and perform merge work in your topic branch.
Register on Github
If you want to create a clone to make merge requests back, you need a github account. Sign up for a free account here.https://github.com/signup/free
Creating your own private repository clone
It is best to create your own clone and work on it, in whatever branch you need. You can then submit a merge request to have your features merged into the main repositoryhttp://help.github.com/fork-a-repo/
Quick Summary
There is more detail in the following sections, but here is a quick rundown of how one might submit a change for 1.2.x after making a repo clone above:git clone git@rcs.pfsense.org:pfsense/myname-mystuff.git mydirectory cd mydirectory git checkout -b RELENG_1_2 origin/RELENG_1_2 # work, work, work, patch, patch, patch git commit -a # type a description for the commit git push
Checking out pfSense's GIT repo anonymously
git clone https://github.com/bsdperimeter/pfsense.git cd mainline # cd into the repo. git status # On branch master - note that the default is "master" which is similar to HEAD in CVS speak.
Checking out pfSense's GIT repo with a rcs.pfsense.org account
Your SSH key must be available, as entered in Github.git clone git@github.com:bsdperimeter/pfsense.git
Checking out RELENG_1_2
To setup the initial tracking branch, you would dogit checkout -b RELENG_1_2 origin/RELENG_1_2
would look like:
(billm) pfsense-git$ git checkout -b RELENG_1_2 origin/RELENG_1_2 Branch RELENG_1_2 set up to track remote branch refs/remotes/origin/RELENG_1_2. Switched to a new branch "RELENG_1_2" (billm) pfsense-git$
Subsequent checkouts (or branch changing) will look like
git checkout RELENG_1_2
How to keep your clone in sync with the mainline repo
So here's the situation you created a Gitorious clone of the pfsense 'mainline' repository to 'myclone'. You've now cloned that repository using git to your local machine and made changes. You've pushed those changes upstream to 'myclone' in Gitorious, but noticed that in the meantime the pfsense 'mainline' repository has had some changes merged. The question quickly becomes, how do I bring the pfsense 'mainline' changes into 'myclone'?http://github.com/guides/keeping-a-git-fork-in-sync-with-the-forked-repo is a good doc to read on this
On your local repository you need to:
# Add the remote tracking branch 'mainline' (example only, use a name of your choice)
git remote add mainline http://gitweb.pfsense.org/pfsense/mainline.git
# Fetch the mainline
git fetch mainline git merge mainline/master
# If you've done everything normally the 'origin' branch will point at your 'myclone' Gitorious repository
git push origin
Problems?
You should really not use "pull" - instead, do this:git commit -a git fetch git rebase origin
You can fix messages like "Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded" by commiting your work, and then rebasing.
If you find that after "git fetch", you cannot "git rebase origin" because it says that files need updating, you may need to reset like so:
git fetch git reset --hard origin
Be aware that you'll lose your local changes, but when I saw this error they were actually files I had never touched, and checking them out again did not help.