diff options
author | Eric Sandall | 2007-03-29 00:12:39 -0700 |
---|---|---|
committer | Eric Sandall | 2007-03-29 00:12:39 -0700 |
commit | 746ed947f8852589e43d274602e6716640dcabca (patch) | |
tree | 2e04c4a419a389c64aae1f1aee6acbda25893040 | |
parent | a15410f2c4752a9cf5f3f432994e7cd93c093872 (diff) |
GrimoireGuruHandbook.tex: Finished the majority of use cases for git
-rw-r--r-- | GrimoireGuruHandbook.tex | 134 |
1 files changed, 128 insertions, 6 deletions
diff --git a/GrimoireGuruHandbook.tex b/GrimoireGuruHandbook.tex index 2399a41..c06c910 100644 --- a/GrimoireGuruHandbook.tex +++ b/GrimoireGuruHandbook.tex @@ -271,14 +271,136 @@ and remove what should not be there, you will run \textdollar git update-index <files> and then commit your changes. \section{Creating your own local branch} -\section{Creating your own remote branch} +If you are planning on doing an update which might take a while (e.g. +openoffice) you will want to work in your own branch, so you only have to +resolve conflicts once when you merge back to the master branch. +\begin{enumerate} + \item First, make sure we're up-to-date, no point in missing any +commits ;) +\begin{verbatim} + $ git checkout master + $ git pull +\end{verbatim} + \item Now we'll create our own local branch and check it out in one +command +\begin{verbatim} + $ git checkout -b devel-openoffice + Switched to a new branch "devel-openoffice +\end{verbatim} +We may now proceed the long process of getting openoffice to compile. Commit +as often as you want to this branch, it won't hurt anyone. When you want to +work on the rest of the grimoire again, make sure everything is commited and +then checkout ``master'' (or whichever branch you want to work on) and proceed +as normal, devel-openoffice will always be waiting for you. :) + +\end{enumerate} + \section{Checking out other branches} -\section{Integrating between branches} -\section{Updated a stable-rc or stable grimoire} +Checking out another branch will allow you to work on it. Let's say we have +the following remote branches: +\begin{verbatim} + $ git branch -r + origin/HEAD + origin/devel + origin/devel-iceweasel + origin/devel-java + origin/devel-oo + origin/devel-shadow + origin/master + origin/origin +\end{verbatim} +Now, we'd like to try out some of the shadow work that's going on, so let's +check it out. +\begin{verbatim} + $ git checkout -b shadow origin/devel-shadow + Switched to a new branch "shadow" + $ git branch + master +* shadow +\end{verbatim} +We now have our own local ``shadow'' branch to play with, which is linked to +the upstream origin/devel-shadow. + +\section{Deleting a local branch} +Sometimes a branch is a lost cause, or already merged and no longer needed. +You will need to not have the soon to be deleted branch checked out +(``master'' is always a good branch to hang out in) and then you may delete it: +\begin{verbatim} + $ git checkout master + $ git branch -d devel-openoffice +\end{verbatim} +This will only delete the branch if it has been fully merged. If this is a +lost cause branch, feel free to be more forceful: +\begin{verbatim} + $ git branch -D devel-openoffice +\end{verbatim} +This will remove ``devel-openoffice'' no matter its status. + +\section{Renaming a local branch} +If you no longer like the name you've given to a remote branch, fear not! +Renaming is as simple as ``branch -m <old branch> <new branch>'': +\begin{verbatim} + $ git branch -m devel-openoffice openoffice +\end{verbatim} -These grimoires are special, in that you never modify them directly -(similar to how you treat the origin branch). To update one of these (say -stable-rc-0.8), you will use the following steps: +\section{Creating your own remote branch} +We have our devel-openoffice branch on our machine, but others are wanting to +help with it, so we'll push it to the upstream grimoire.git on sourcemage.org. + +\begin{enumerate} + \item Check out the branch we wish to push + \begin{verbatim} + $ git checkout devel-openoffice + \end{verbatim} + \item Now we push our currently checked out branch onto the remote + \begin{verbatim} + $ git push origin devel-openoffice +updating 'refs/heads/devel-openoffice' + from 0000000000000000000000000000000000000000 + to fa9869a20bbfb479fafd63ef41e890919df3b6d9 +Generating pack... +Done counting 0 objects. +Writing 0 objects. +Unpacking 0 objects + +refs/heads/foo: 0000000000000000000000000000000000000000 -> +fa9869a20bbfb479fafd63ef41e890919df3b6d9 +Total 0 (delta 0), reused 0 (delta 0) + \end{verbatim} + \item We'll need to go back to master for some updates + \begin{verbatim} + $ git checkout master + $ git pull +* refs/remotes/origin/devel-openoffice: storing branch 'devel-openoffice' of +/home/sandalle/tmp/grimoire/ + commit: fa9869a +Already up-to-date. + \end{verbatim} +devel-openoffice should now be a remote branch + \item Check that devel-openoffice is remote + \begin{verbatim} +$ git branch -r + origin/HEAD + origin/devel-openoffice + origin/master + \end{verbatim} + \item Remove your local devel-openoffice (since it is not linked with +the remote, it will be difficult to keep them in sync) + \begin{verbatim} + $ git branch -D devel-openoffice + \end{verbatim} + \item Check out the remote devel-openoffice to your local branch + \begin{verbatim} + $ git checkout -b devel-openoffice origin/devel-openoffice + \end{verbatim} +\end{enumerate} +You are now set to collaborate on the devel-openoffice branch with other +developers. :) + +\section{Integrating between branches} +Let's say we want to merge some fixes from our test (``master'') grimoire into +stable-rc and stable. To update one of these (say stable-rc-0.8), you will use +the following steps: \begin{enumerate} \item Checkout the the origin/stable-rc-0.8 branch and call it stable-rc-0.6 locally. |