FlightGear Git: Difference between revisions

Jump to navigation Jump to search
→‎Supporting information: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg35244.html
(→‎git pull: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg30765.html)
(→‎Supporting information: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg35244.html)
Line 306: Line 306:
: may be used for future updates
: may be used for future updates


=== git remote - adding remote repositories ===
Now, before anyone unnecessarily goes through the pain of cloning fgdata
again, you just need to add the git URL to your new personal
clone at gitorious as a remote in your local fgdata clone to be able to
push to gitorious.
For example:
'''git remote add my-fgdata g...@gitorious.org:~andersg/fg/anders-fgdata.git'''
Stores the URL to my fgdata clone at gitorious under the name my-fgdata in  my local git clone of fgdata. (You want the gitorious SSH URL for your repository)
'''git push my-fgdata my-branch:master'''
Pushes the local branch named my-branch to my-fgdata (i.e. my clone of fgdata at gitorious) where the branch will be named master.


=== git pull ===
=== git pull ===
Line 355: Line 371:
git branch my-branch.20110205  my-branch
git branch my-branch.20110205  my-branch
</pre>
</pre>
=== Merging Topic Branches ===
You want to merge your branch back into master. merge is the right word:
* git checkout master
* git merge newidea
done. If the merge creates conflicts, git will tell you so. To fix them, simply edit the files and add them to the index (git add fixed_file) and when you are done do a git commit. A merge usually creates a new commit anyway, since it's a new version of your source tree.
If your newidea branch is nice and tidy and a straight continuation of your current master branch (i.e. they have not diverged) you can just  merge the newidea branch into master (if they have not diverged it will just be a fast-forward of the master branch).
You can create a new branch to keep track of your old master point first if you like:
'''git branch old-master master'''
git branch -h  or --help will show many useful options to git branch e.g. for creating, renaming and deleting branches.
As long as you don't rewrite the history you can always create a new branch starting at any old commit so there is no particular need to
create such branches before you need them (except maybe to help remembering where that point was).
If the branches have diverged I would consider cherry-pick over the commits from the newidea branch into master (if they are not very many)
and perhaps also tidy them up with using interactive rebasing before publishing the new master state. This is particularily useful if master is
a public branch that receives commits from other developers - it avoids the rather ugly multiple levels of merges we see in e.g. fgdata. (See also git rebase).
gitk --all is a very useful tool to see where your different branches are in the history and how they relate to each other.
While on the master branch:
'''git merge newidea'''


=== Keeping topic branches in sync with upstream ===
=== Keeping topic branches in sync with upstream ===

Navigation menu