diff --git a/app/views/doc/_ebooks.html.erb b/app/views/doc/_ebooks.html.erb deleted file mode 100644 index a71747ff09..0000000000 --- a/app/views/doc/_ebooks.html.erb +++ /dev/null @@ -1 +0,0 @@ -

Download this book in PDF, mobi, or ePub form for free.

diff --git a/app/views/doc/_ebooks.html.haml b/app/views/doc/_ebooks.html.haml new file mode 100644 index 0000000000..32880568e5 --- /dev/null +++ b/app/views/doc/_ebooks.html.haml @@ -0,0 +1,9 @@ +%p + Download this book in + = succeed "," do + %a{:href => "https://github.s3.amazonaws.com/media/progit.en.pdf"} PDF + = succeed "," do + %a{:href => "https://github.s3.amazonaws.com/media/pro-git.en.mobi"} mobi + or + %a{:href => "https://github.s3.amazonaws.com/media/progit.epub"} ePub + form for free. diff --git a/app/views/doc/_example.html.erb b/app/views/doc/_example.html.erb deleted file mode 100644 index 08372fba65..0000000000 --- a/app/views/doc/_example.html.erb +++ /dev/null @@ -1,1037 +0,0 @@ -
- -

SYNOPSIS

-
-
-
git rebase [-i | --interactive] [options] [--onto <newbase>] - [<upstream>] [<branch>] -git rebase [-i | --interactive] [options] --onto <newbase> - --root [<branch>] -git rebase --continue | --skip | --abort
-
-
-
-

DESCRIPTION

-
-

If <branch> is specified, git rebase will perform an automatic - git checkout <branch> before doing anything else. Otherwise - it remains on the current branch.

-

If <upstream> is not specified, the upstream configured in - branch.<name>.remote and branch.<name>.merge options will be used; see - git-config(1) for details. If you are currently not on any - branch or if the current branch does not have a configured upstream, - the rebase will abort.

-

All changes made by commits in the current branch but that are not - in <upstream> are saved to a temporary area. This is the same set - of commits that would be shown by git log <upstream>..HEAD (or - git log HEAD, if --root is specified).

-

The current branch is reset to <upstream>, or <newbase> if the - --onto option was supplied. This has the exact same effect as - git reset --hard <upstream> (or <newbase>). ORIG_HEAD is set - to point at the tip of the branch before the reset.

-

The commits that were previously saved into the temporary area are - then reapplied to the current branch, one by one, in order. Note that - any commits in HEAD which introduce the same textual changes as a commit - in HEAD..<upstream> are omitted (i.e., a patch already accepted upstream - with a different commit message or timestamp will be skipped).

-

It is possible that a merge failure will prevent this process from being - completely automatic. You will have to resolve any such merge failure - and run git rebase --continue. Another option is to bypass the commit - that caused the merge failure with git rebase --skip. To check out the - original <branch> and remove the .git/rebase-apply working files, use the - command git rebase --abort instead.

-

Assume the following history exists and the current branch is "topic":

-
-
-
          A---B---C topic
         /
    D---E---F---G master
-
-

From this point, the result of either of the following commands:

-
-
-
git rebase master
git rebase master topic
-
-

would be:

-
-
-
                  A'--B'--C' topic
                 /
    D---E---F---G master
-
-

NOTE: The latter form is just a short-hand of git checkout topic - followed by git rebase master. When rebase exits topic will - remain the checked-out branch.

-

If the upstream branch already contains a change you have made (e.g., - because you mailed a patch which was applied upstream), then that commit - will be skipped. For example, running ‘git rebase master` on the - following history (in which A’ and A introduce the same set of changes, - but have different committer information):

-
-
-
          A---B---C topic
         /
    D---E---A'---F master
-
-

will result in:

-
-
-
                   B'---C' topic
                  /
    D---E---A'---F master
-
-

Here is how you would transplant a topic branch based on one - branch to another, to pretend that you forked the topic branch - from the latter branch, using rebase --onto.

-

First let’s assume your topic is based on branch next. - For example, a feature developed in topic depends on some - functionality which is found in next.

-
-
-
    o---o---o---o---o  master
         \
          o---o---o---o---o  next
                           \
                            o---o---o  topic
-
-

We want to make topic forked from branch master; for example, - because the functionality on which topic depends was merged into the - more stable master branch. We want our tree to look like this:

-
-
-
    o---o---o---o---o  master
        |            \
        |             o'--o'--o'  topic
         \
          o---o---o---o---o  next
-
-

We can get this using the following command:

-
-
-
git rebase --onto master next topic
-
-

Another example of --onto option is to rebase part of a - branch. If we have the following situation:

-
-
-
                            H---I---J topicB
                           /
                  E---F---G  topicA
                 /
    A---B---C---D  master
-
-

then the command

-
-
-
git rebase --onto master topicA topicB
-
-

would result in:

-
-
-
                 H'--I'--J'  topicB
                /
                | E---F---G  topicA
                |/
    A---B---C---D  master
-
-

This is useful when topicB does not depend on topicA.

-

A range of commits could also be removed with rebase. If we have - the following situation:

-
-
-
    E---F---G---H---I---J  topicA
-
-

then the command

-
-
-
git rebase --onto topicA~5 topicA~3 topicA
-
-

would result in the removal of commits F and G:

-
-
-
    E---H'---I'---J'  topicA
-
-

This is useful if F and G were flawed in some way, or should not be - part of topicA. Note that the argument to --onto and the <upstream> - parameter can be any valid commit-ish.

-

In case of conflict, git rebase will stop at the first problematic commit - and leave conflict markers in the tree. You can use git diff to locate - the markers (<<<<<<) and make edits to resolve the conflict. For each - file you edit, you need to tell git that the conflict has been resolved, - typically this would be done with

-
-
-
git add <filename>
-
-

After resolving the conflict manually and updating the index with the - desired resolution, you can continue the rebasing process with

-
-
-
git rebase --continue
-
-

Alternatively, you can undo the git rebase with

-
-
-
git rebase --abort
-
-
-

CONFIGURATION

-
-
-
- rebase.stat -
-
-

- Whether to show a diffstat of what changed upstream since the last - rebase. False by default. -

-
-
- rebase.autosquash -
-
-

- If set to true enable --autosquash option by default. -

-
-
-
-

OPTIONS

-
-
-
- <newbase> -
-
-

- Starting point at which to create the new commits. If the - --onto option is not specified, the starting point is - <upstream>. May be any valid commit, and not just an - existing branch name. -

-

As a special case, you may use "A...B" as a shortcut for the - merge base of A and B if there is exactly one merge base. You can - leave out at most one of A and B, in which case it defaults to HEAD.

-
-
- <upstream> -
-
-

- Upstream branch to compare against. May be any valid commit, - not just an existing branch name. Defaults to the configured - upstream for the current branch. -

-
-
- <branch> -
-
-

- Working branch; defaults to HEAD. -

-
-
- --continue -
-
-

- Restart the rebasing process after having resolved a merge conflict. -

-
-
- --abort -
-
-

- Abort the rebase operation and reset HEAD to the original - branch. If <branch> was provided when the rebase operation was - started, then HEAD will be reset to <branch>. Otherwise HEAD - will be reset to where it was when the rebase operation was - started. -

-
-
- --skip -
-
-

- Restart the rebasing process by skipping the current patch. -

-
-
- -m -
-
- --merge -
-
-

- Use merging strategies to rebase. When the recursive (default) merge - strategy is used, this allows rebase to be aware of renames on the - upstream side. -

-

Note that a rebase merge works by replaying each commit from the working - branch on top of the <upstream> branch. Because of this, when a merge - conflict happens, the side reported as ours is the so-far rebased - series, starting with <upstream>, and theirs is the working branch. In - other words, the sides are swapped.

-
-
- -s <strategy> -
-
- --strategy=<strategy> -
-
-

- Use the given merge strategy. - If there is no -s option git merge-recursive is used - instead. This implies --merge. -

-

Because git rebase replays each commit from the working branch - on top of the <upstream> branch using the given strategy, using - the ours strategy simply discards all patches from the <branch>, - which makes little sense.

-
-
- -X <strategy-option> -
-
- --strategy-option=<strategy-option> -
-
-

- Pass the <strategy-option> through to the merge strategy. - This implies --merge and, if no strategy has been - specified, -s recursive. Note the reversal of ours and - theirs as noted in above for the -m option. -

-
-
- -q -
-
- --quiet -
-
-

- Be quiet. Implies --no-stat. -

-
-
- -v -
-
- --verbose -
-
-

- Be verbose. Implies --stat. -

-
-
- --stat -
-
-

- Show a diffstat of what changed upstream since the last rebase. The - diffstat is also controlled by the configuration option rebase.stat. -

-
-
- -n -
-
- --no-stat -
-
-

- Do not show a diffstat as part of the rebase process. -

-
-
- --no-verify -
-
-

- This option bypasses the pre-rebase hook. See also githooks(5). -

-
-
- --verify -
-
-

- Allows the pre-rebase hook to run, which is the default. This option can - be used to override --no-verify. See also githooks(5). -

-
-
- -C<n> -
-
-

- Ensure at least <n> lines of surrounding context match before - and after each change. When fewer lines of surrounding - context exist they all must match. By default no context is - ever ignored. -

-
-
- -f -
-
- --force-rebase -
-
-

- Force the rebase even if the current branch is a descendant - of the commit you are rebasing onto. Normally non-interactive rebase will - exit with the message "Current branch is up to date" in such a - situation. - Incompatible with the --interactive option. -

-

You may find this (or --no-ff with an interactive rebase) helpful after - reverting a topic branch merge, as this option recreates the topic branch with - fresh commits so it can be remerged successfully without needing to "revert - the reversion" (see the - revert-a-faulty-merge How-To for details).

-
-
- --ignore-whitespace -
-
- --whitespace=<option> -
-
-

- These flag are passed to the git apply program - (see git-apply(1)) that applies the patch. - Incompatible with the --interactive option. -

-
-
- --committer-date-is-author-date -
-
- --ignore-date -
-
-

- These flags are passed to git am to easily change the dates - of the rebased commits (see git-am(1)). - Incompatible with the --interactive option. -

-
-
- -i -
-
- --interactive -
-
-

- Make a list of the commits which are about to be rebased. Let the - user edit that list before rebasing. This mode can also be used to - split commits (see SPLITTING COMMITS below). -

-
-
- -p -
-
- --preserve-merges -
-
-

- Instead of ignoring merges, try to recreate them. -

-

This uses the --interactive machinery internally, but combining it - with the --interactive option explicitly is generally not a good - idea unless you know what you are doing (see BUGS below).

-
-
- --root -
-
-

- Rebase all commits reachable from <branch>, instead of - limiting them with an <upstream>. This allows you to rebase - the root commit(s) on a branch. Must be used with --onto, and - will skip changes already contained in <newbase> (instead of - <upstream>). When used together with --preserve-merges, all - root commits will be rewritten to have <newbase> as parent - instead. -

-
-
- --autosquash -
-
- --no-autosquash -
-
-

- When the commit log message begins with "squash! …" (or - "fixup! …"), and there is a commit whose title begins with - the same …, automatically modify the todo list of rebase -i - so that the commit marked for squashing comes right after the - commit to be modified, and change the action of the moved - commit from pick to squash (or fixup). -

-

This option is only valid when the --interactive option is used.

-

If the --autosquash option is enabled by default using the - configuration variable rebase.autosquash, this option can be - used to override and disable this setting.

-
-
- --no-ff -
-
-

- With --interactive, cherry-pick all rebased commits instead of - fast-forwarding over the unchanged ones. This ensures that the - entire history of the rebased branch is composed of new commits. -

-

Without --interactive, this is a synonym for --force-rebase.

-

You may find this helpful after reverting a topic branch merge, as this option - recreates the topic branch with fresh commits so it can be remerged - successfully without needing to "revert the reversion" (see the - revert-a-faulty-merge How-To for details).

-
-
-
-

MERGE STRATEGIES

-
-

The merge mechanism (git-merge and git-pull commands) allows the - backend merge strategies to be chosen with -s option. Some strategies - can also take their own options, which can be passed by giving -X<option> - arguments to git-merge and/or git-pull.

-
-
- resolve -
-
-

- This can only resolve two heads (i.e. the current branch - and another branch you pulled from) using a 3-way merge - algorithm. It tries to carefully detect criss-cross - merge ambiguities and is considered generally safe and - fast. -

-
-
- recursive -
-
-

- This can only resolve two heads using a 3-way merge - algorithm. When there is more than one common - ancestor that can be used for 3-way merge, it creates a - merged tree of the common ancestors and uses that as - the reference tree for the 3-way merge. This has been - reported to result in fewer merge conflicts without - causing mis-merges by tests done on actual merge commits - taken from Linux 2.6 kernel development history. - Additionally this can detect and handle merges involving - renames. This is the default merge strategy when - pulling or merging one branch. -

-

The recursive strategy can take the following options:

-
-
- ours -
-
-

- This option forces conflicting hunks to be auto-resolved cleanly by - favoring our version. Changes from the other tree that do not - conflict with our side are reflected to the merge result. -

-

This should not be confused with the ours merge strategy, which does not - even look at what the other tree contains at all. It discards everything - the other tree did, declaring our history contains all that happened in it.

-
-
- theirs -
-
-

- This is opposite of ours. -

-
-
- patience -
-
-

- With this option, merge-recursive spends a little extra time - to avoid mismerges that sometimes occur due to unimportant - matching lines (e.g., braces from distinct functions). Use - this when the branches to be merged have diverged wildly. - See also git-diff(1) --patience. -

-
-
- ignore-space-change -
-
- ignore-all-space -
-
- ignore-space-at-eol -
-
-

- Treats lines with the indicated type of whitespace change as - unchanged for the sake of a three-way merge. Whitespace - changes mixed with other changes to a line are not ignored. - See also git-diff(1) -b, -w, and - --ignore-space-at-eol. -

-
    -
  • -

    - If their version only introduces whitespace changes to a line, - our version is used; -

    -
  • -
  • -

    - If our version introduces whitespace changes but their - version includes a substantial change, their version is used; -

    -
  • -
  • -

    - Otherwise, the merge proceeds in the usual way. -

    -
  • -
-
-
- renormalize -
-
-

- This runs a virtual check-out and check-in of all three stages - of a file when resolving a three-way merge. This option is - meant to be used when merging branches with different clean - filters or end-of-line normalization rules. See "Merging - branches with differing checkin/checkout attributes" in - gitattributes(5) for details. -

-
-
- no-renormalize -
-
-

- Disables the renormalize option. This overrides the - merge.renormalize configuration variable. -

-
-
- rename-threshold=<n> -
-
-

- Controls the similarity threshold used for rename detection. - See also git-diff(1) -M. -

-
-
- subtree[=<path>] -
-
-

- This option is a more advanced form of subtree strategy, where - the strategy makes a guess on how two trees must be shifted to - match with each other when merging. Instead, the specified path - is prefixed (or stripped from the beginning) to make the shape of - two trees to match. -

-
-
-
-
- octopus -
-
-

- This resolves cases with more than two heads, but refuses to do - a complex merge that needs manual resolution. It is - primarily meant to be used for bundling topic branch - heads together. This is the default merge strategy when - pulling or merging more than one branch. -

-
-
- ours -
-
-

- This resolves any number of heads, but the resulting tree of the - merge is always that of the current branch head, effectively - ignoring all changes from all other branches. It is meant to - be used to supersede old development history of side - branches. Note that this is different from the -Xours option to - the recursive merge strategy. -

-
-
- subtree -
-
-

- This is a modified recursive strategy. When merging trees A and - B, if B corresponds to a subtree of A, B is first adjusted to - match the tree structure of A, instead of reading the trees at - the same level. This adjustment is also done to the common - ancestor tree. -

-
-
-
-

NOTES

-
-

You should understand the implications of using git rebase on a - repository that you share. See also RECOVERING FROM UPSTREAM REBASE - below.

-

When the git-rebase command is run, it will first execute a "pre-rebase" - hook if one exists. You can use this hook to do sanity checks and - reject the rebase if it isn’t appropriate. Please see the template - pre-rebase hook script for an example.

-

Upon completion, <branch> will be the current branch.

-
-

INTERACTIVE MODE

-
-

Rebasing interactively means that you have a chance to edit the commits - which are rebased. You can reorder the commits, and you can - remove them (weeding out bad or otherwise unwanted patches).

-

The interactive mode is meant for this type of workflow:

-
    -
  1. -

    - have a wonderful idea -

    -
  2. -
  3. -

    - hack on the code -

    -
  4. -
  5. -

    - prepare a series for submission -

    -
  6. -
  7. -

    - submit -

    -
  8. -
-

where point 2. consists of several instances of

-
    -
  1. -

    - regular use -

    -
      -
    1. -

      - finish something worthy of a commit -

      -
    2. -
    3. -

      - commit -

      -
    4. -
    -
  2. -
  3. -

    - independent fixup -

    -
      -
    1. -

      - realize that something does not work -

      -
    2. -
    3. -

      - fix that -

      -
    4. -
    5. -

      - commit it -

      -
    6. -
    -
  4. -
-

Sometimes the thing fixed in b.2. cannot be amended to the not-quite - perfect commit it fixes, because that commit is buried deeply in a - patch series. That is exactly what interactive rebase is for: use it - after plenty of "a"s and "b"s, by rearranging and editing - commits, and squashing multiple commits into one.

-

Start it with the last commit you want to retain as-is:

-
-
-
git rebase -i <after-this-commit>
-
-

An editor will be fired up with all the commits in your current branch - (ignoring merge commits), which come after the given commit. You can - reorder the commits in this list to your heart’s content, and you can - remove them. The list looks more or less like this:

-
-
-
pick deadbee The oneline of this commit
pick fa1afe1 The oneline of the next commit
...
-
-

The oneline descriptions are purely for your pleasure; git rebase will - not look at them but at the commit names ("deadbee" and "fa1afe1" in this - example), so do not delete or edit the names.

-

By replacing the command "pick" with the command "edit", you can tell - git rebase to stop after applying that commit, so that you can edit - the files and/or the commit message, amend the commit, and continue - rebasing.

-

If you just want to edit the commit message for a commit, replace the - command "pick" with the command "reword".

-

If you want to fold two or more commits into one, replace the command - "pick" for the second and subsequent commits with "squash" or "fixup". - If the commits had different authors, the folded commit will be - attributed to the author of the first commit. The suggested commit - message for the folded commit is the concatenation of the commit - messages of the first commit and of those with the "squash" command, - but omits the commit messages of commits with the "fixup" command.

-

git rebase will stop when "pick" has been replaced with "edit" or - when a command fails due to merge errors. When you are done editing - and/or resolving conflicts you can continue with git rebase --continue.

-

For example, if you want to reorder the last 5 commits, such that what - was HEAD~4 becomes the new HEAD. To achieve that, you would call - git rebase like this:

-
-
-
$ git rebase -i HEAD~5
-
-

And move the first patch to the end of the list.

-

You might want to preserve merges, if you have a history like this:

-
-
-
           X
            \
         A---M---B
        /
---o---O---P---Q
-
-

Suppose you want to rebase the side branch starting at "A" to "Q". Make - sure that the current HEAD is "B", and call

-
-
-
$ git rebase -i -p --onto Q O
-
-

Reordering and editing commits usually creates untested intermediate - steps. You may want to check that your history editing did not break - anything by running a test, or at least recompiling at intermediate - points in history by using the "exec" command (shortcut "x"). You may - do so by creating a todo list like this one:

-
-
-
pick deadbee Implement feature XXX
fixup f1a5c00 Fix to feature XXX
exec make
pick c0ffeee The oneline of the next commit
edit deadbab The oneline of the commit after
exec cd subdir; make test
...
-
-

The interactive rebase will stop when a command fails (i.e. exits with - non-0 status) to give you an opportunity to fix the problem. You can - continue with git rebase --continue.

-

The "exec" command launches the command in a shell (the one specified - in $SHELL, or the default shell if $SHELL is not set), so you can - use shell features (like "cd", ">", ";" …). The command is run from - the root of the working tree.

-
-

SPLITTING COMMITS

-
-

In interactive mode, you can mark commits with the action "edit". However, - this does not necessarily mean that git rebase expects the result of this - edit to be exactly one commit. Indeed, you can undo the commit, or you can - add other commits. This can be used to split a commit into two:

-
    -
  • -

    - Start an interactive rebase with git rebase -i <commit>^, where - <commit> is the commit you want to split. In fact, any commit range - will do, as long as it contains that commit. -

    -
  • -
  • -

    - Mark the commit you want to split with the action "edit". -

    -
  • -
  • -

    - When it comes to editing that commit, execute git reset HEAD^. The - effect is that the HEAD is rewound by one, and the index follows suit. - However, the working tree stays the same. -

    -
  • -
  • -

    - Now add the changes to the index that you want to have in the first - commit. You can use git add (possibly interactively) or - git gui (or both) to do that. -

    -
  • -
  • -

    - Commit the now-current index with whatever commit message is appropriate - now. -

    -
  • -
  • -

    - Repeat the last two steps until your working tree is clean. -

    -
  • -
  • -

    - Continue the rebase with git rebase --continue. -

    -
  • -
-

If you are not absolutely sure that the intermediate revisions are - consistent (they compile, pass the testsuite, etc.) you should use - git stash to stash away the not-yet-committed changes - after each commit, test, and amend the commit if fixes are necessary.

-
-

RECOVERING FROM UPSTREAM REBASE

-
-

Rebasing (or any other form of rewriting) a branch that others have - based work on is a bad idea: anyone downstream of it is forced to - manually fix their history. This section explains how to do the fix - from the downstream’s point of view. The real fix, however, would be - to avoid rebasing the upstream in the first place.

-

To illustrate, suppose you are in a situation where someone develops a - subsystem branch, and you are working on a topic that is dependent - on this subsystem. You might end up with a history like the - following:

-
-
-
    o---o---o---o---o---o---o---o---o  master
         \
          o---o---o---o---o  subsystem
                           \
                            *---*---*  topic
-
-

If subsystem is rebased against master, the following happens:

-
-
-
    o---o---o---o---o---o---o---o  master
         \                       \
          o---o---o---o---o       o'--o'--o'--o'--o'  subsystem
                           \
                            *---*---*  topic
-
-

If you now continue development as usual, and eventually merge topic - to subsystem, the commits from subsystem will remain duplicated forever:

-
-
-
    o---o---o---o---o---o---o---o  master
         \                       \
          o---o---o---o---o       o'--o'--o'--o'--o'--M  subsystem
                           \                         /
                            *---*---*-..........-*--*  topic
-
-

Such duplicates are generally frowned upon because they clutter up - history, making it harder to follow. To clean things up, you need to - transplant the commits on topic to the new subsystem tip, i.e., - rebase topic. This becomes a ripple effect: anyone downstream from - topic is forced to rebase too, and so on!

-

There are two kinds of fixes, discussed in the following subsections:

-
-
- Easy case: The changes are literally the same. -
-
-

- This happens if the subsystem rebase was a simple rebase and - had no conflicts. -

-
-
- Hard case: The changes are not the same. -
-
-

- This happens if the subsystem rebase had conflicts, or used - --interactive to omit, edit, squash, or fixup commits; or - if the upstream used one of commit --amend, reset, or - filter-branch. -

-
-
-

The easy case

-

Only works if the changes (patch IDs based on the diff contents) on - subsystem are literally the same before and after the rebase - subsystem did.

-

In that case, the fix is easy because git rebase knows to skip - changes that are already present in the new upstream. So if you say - (assuming you’re on topic)

-
-
-
    $ git rebase subsystem
-
-

you will end up with the fixed history

-
-
-
    o---o---o---o---o---o---o---o  master
                                 \
                                  o'--o'--o'--o'--o'  subsystem
                                                   \
                                                    *---*---*  topic
-
-

The hard case

-

Things get more complicated if the subsystem changes do not exactly - correspond to the ones before the rebase.

-
- - - -
-
Note
-
While an "easy case recovery" sometimes appears to be successful - even in the hard case, it may have unintended consequences. For - example, a commit that was removed via git rebase - --interactive will be resurrected!
-
-

The idea is to manually tell git rebase "where the old subsystem - ended and your topic began", that is, what the old merge-base - between them was. You will have to find a way to name the last commit - of the old subsystem, for example:

-
    -
  • -

    - With the subsystem reflog: after git fetch, the old tip of - subsystem is at subsystem@{1}. Subsequent fetches will - increase the number. (See git-reflog(1).) -

    -
  • -
  • -

    - Relative to the tip of topic: knowing that your topic has three - commits, the old tip of subsystem must be topic~3. -

    -
  • -
-

You can then transplant the old subsystem..topic to the new tip by - saying (for the reflog case, and assuming you are on topic already):

-
-
-
    $ git rebase --onto subsystem subsystem@{1}
-
-

The ripple effect of a "hard case" recovery is especially bad: - everyone downstream from topic will now have to perform a "hard - case" recovery too!

-
-

BUGS

-
-

The todo list presented by --preserve-merges --interactive does not - represent the topology of the revision graph. Editing commits and - rewording their commit messages should work fine, but attempts to - reorder commits tend to produce counterintuitive results.

-

For example, an attempt to rearrange

-
-
-
1 --- 2 --- 3 --- 4 --- 5
-
-

to

-
-
-
1 --- 2 --- 4 --- 3 --- 5
-
-

by moving the "pick 4" line will result in the following history:

-
-
-
        3
       /
1 --- 2 --- 4 --- 5
-
-
-

GIT

-
-

Part of the git(1) suite

-
- -
diff --git a/app/views/doc/_example.html.haml b/app/views/doc/_example.html.haml new file mode 100644 index 0000000000..66312f3045 --- /dev/null +++ b/app/views/doc/_example.html.haml @@ -0,0 +1,1329 @@ +.man-page + #header + %h1 + git-rebase(1) Manual Page + %h2 NAME + .sectionbody + %p + git-rebase - + Forward-port local commits to the updated upstream head + %h2#_synopsis SYNOPSIS + .sectionbody + .verseblock + .verseblock-content + %em git rebase + [-i | --interactive] [options] [--onto <newbase>] + [<upstream>] [<branch>] + %em git rebase + [-i | --interactive] [options] --onto <newbase> + \--root [<branch>] + %em git rebase + \--continue | --skip | --abort + .verseblock-attribution + %h2#_description DESCRIPTION + .sectionbody + .paragraph + %p + If <branch> is specified, + %em git rebase + will perform an automatic + %tt git checkout <branch> + before doing anything else. Otherwise + it remains on the current branch. + .paragraph + %p + If <upstream> is not specified, the upstream configured in + branch.<name>.remote and branch.<name>.merge options will be used; see + %a{:href => "git-config.html"} git-config(1) + for details. If you are currently not on any + branch or if the current branch does not have a configured upstream, + the rebase will abort. + .paragraph + %p + All changes made by commits in the current branch but that are not + in <upstream> are saved to a temporary area. This is the same set + of commits that would be shown by + %tt git log <upstream>..HEAD + (or + = succeed "," do + %tt git log HEAD + if --root is specified). + .paragraph + %p + The current branch is reset to <upstream>, or <newbase> if the + \--onto option was supplied. This has the exact same effect as + %tt git reset --hard <upstream> + (or <newbase>). ORIG_HEAD is set + to point at the tip of the branch before the reset. + .paragraph + %p + The commits that were previously saved into the temporary area are + then reapplied to the current branch, one by one, in order. Note that + any commits in HEAD which introduce the same textual changes as a commit + in HEAD..<upstream> are omitted (i.e., a patch already accepted upstream + with a different commit message or timestamp will be skipped). + .paragraph + %p + It is possible that a merge failure will prevent this process from being + completely automatic. You will have to resolve any such merge failure + and run + = succeed "." do + %tt git rebase --continue + Another option is to bypass the commit + that caused the merge failure with + = succeed "." do + %tt git rebase --skip + To check out the + original <branch> and remove the .git/rebase-apply working files, use the + command + %tt git rebase --abort + instead. + .paragraph + %p Assume the following history exists and the current branch is "topic": + .listingblock + .content + %pre + %tt + A---B---C topic + \/ + D---E---F---G master + .paragraph + %p From this point, the result of either of the following commands: + .literalblock + .content + %pre + %tt + git rebase master + git rebase master topic + .paragraph + %p would be: + .listingblock + .content + %pre + %tt + A'--B'--C' topic + \/ + D---E---F---G master + .paragraph + %p + %strong NOTE: + The latter form is just a short-hand of + %tt git checkout topic + followed by + = succeed "." do + %tt git rebase master + When rebase exits + %tt topic + will + remain the checked-out branch. + .paragraph + %p + If the upstream branch already contains a change you have made (e.g., + because you mailed a patch which was applied upstream), then that commit + will be skipped. For example, running ‘git rebase master` on the + following history (in which A’ and A introduce the same set of changes, + but have different committer information): + .listingblock + .content + %pre + %tt + A---B---C topic + \/ + D---E---A'---F master + .paragraph + %p will result in: + .listingblock + .content + %pre + %tt + B'---C' topic + \/ + D---E---A'---F master + .paragraph + %p + Here is how you would transplant a topic branch based on one + branch to another, to pretend that you forked the topic branch + from the latter branch, using + = succeed "." do + %tt rebase --onto + .paragraph + %p + First let’s assume your + %em topic + is based on branch + = succeed "." do + %em next + For example, a feature developed in + %em topic + depends on some + functionality which is found in + = succeed "." do + %em next + .listingblock + .content + %pre + %tt + o---o---o---o---o master + \\ + o---o---o---o---o next + \\ + o---o---o topic + .paragraph + %p + We want to make + %em topic + forked from branch + = succeed ";" do + %em master + for example, + because the functionality on which + %em topic + depends was merged into the + more stable + %em master + branch. We want our tree to look like this: + .listingblock + .content + %pre + %tt + o---o---o---o---o master + | \ + | o'--o'--o' topic + \\ + o---o---o---o---o next + .paragraph + %p We can get this using the following command: + .literalblock + .content + %pre + %tt git rebase --onto master next topic + .paragraph + %p + Another example of --onto option is to rebase part of a + branch. If we have the following situation: + .listingblock + .content + %pre + %tt + H---I---J topicB + \/ + E---F---G topicA + \/ + A---B---C---D master + .paragraph + %p then the command + .literalblock + .content + %pre + %tt git rebase --onto master topicA topicB + .paragraph + %p would result in: + .listingblock + .content + %pre + %tt + H'--I'--J' topicB + \/ + | E---F---G topicA + |/ + A---B---C---D master + .paragraph + %p This is useful when topicB does not depend on topicA. + .paragraph + %p + A range of commits could also be removed with rebase. If we have + the following situation: + .listingblock + .content + %pre + %tt E---F---G---H---I---J topicA + .paragraph + %p then the command + .literalblock + .content + %pre + %tt git rebase --onto topicA~5 topicA~3 topicA + .paragraph + %p would result in the removal of commits F and G: + .listingblock + .content + %pre + %tt E---H'---I'---J' topicA + .paragraph + %p + This is useful if F and G were flawed in some way, or should not be + part of topicA. Note that the argument to --onto and the <upstream> + parameter can be any valid commit-ish. + .paragraph + %p + In case of conflict, + %em git rebase + will stop at the first problematic commit + and leave conflict markers in the tree. You can use + %em git diff + to locate + the markers (<<<<<<) and make edits to resolve the conflict. For each + file you edit, you need to tell git that the conflict has been resolved, + typically this would be done with + .literalblock + .content + %pre + %tt git add <filename> + .paragraph + %p + After resolving the conflict manually and updating the index with the + desired resolution, you can continue the rebasing process with + .literalblock + .content + %pre + %tt git rebase --continue + .paragraph + %p + Alternatively, you can undo the + %em git rebase + with + .literalblock + .content + %pre + %tt git rebase --abort + %h2#_configuration CONFIGURATION + .sectionbody + .dlist + %dl + %dt.hdlist1 + rebase.stat + %dd + %p + Whether to show a diffstat of what changed upstream since the last + rebase. False by default. + %dt.hdlist1 + rebase.autosquash + %dd + %p + If set to true enable + %em --autosquash + option by default. + %h2#_options OPTIONS + .sectionbody + .dlist + %dl + %dt.hdlist1 + \<newbase> + %dd + %p + Starting point at which to create the new commits. If the + \--onto option is not specified, the starting point is + \<upstream>. May be any valid commit, and not just an + existing branch name. + .paragraph + %p + As a special case, you may use "A...B" as a shortcut for the + merge base of A and B if there is exactly one merge base. You can + leave out at most one of A and B, in which case it defaults to HEAD. + %dt.hdlist1 + \<upstream> + %dd + %p + Upstream branch to compare against. May be any valid commit, + not just an existing branch name. Defaults to the configured + upstream for the current branch. + %dt.hdlist1 + \<branch> + %dd + %p + Working branch; defaults to HEAD. + %dt.hdlist1 + \--continue + %dd + %p + Restart the rebasing process after having resolved a merge conflict. + %dt.hdlist1 + \--abort + %dd + %p + Abort the rebase operation and reset HEAD to the original + branch. If <branch> was provided when the rebase operation was + started, then HEAD will be reset to <branch>. Otherwise HEAD + will be reset to where it was when the rebase operation was + started. + %dt.hdlist1 + \--skip + %dd + %p + Restart the rebasing process by skipping the current patch. + %dt.hdlist1 + \-m + %dt.hdlist1 + \--merge + %dd + %p + Use merging strategies to rebase. When the recursive (default) merge + strategy is used, this allows rebase to be aware of renames on the + upstream side. + .paragraph + %p + Note that a rebase merge works by replaying each commit from the working + branch on top of the <upstream> branch. Because of this, when a merge + conflict happens, the side reported as + %em ours + is the so-far rebased + series, starting with <upstream>, and + %em theirs + is the working branch. In + other words, the sides are swapped. + %dt.hdlist1 + \-s <strategy> + %dt.hdlist1 + \--strategy=<strategy> + %dd + %p + Use the given merge strategy. + If there is no + %tt -s + option + %em git merge-recursive + is used + instead. This implies --merge. + .paragraph + %p + Because + %em git rebase + replays each commit from the working branch + on top of the <upstream> branch using the given strategy, using + the + %em ours + strategy simply discards all patches from the <branch>, + which makes little sense. + %dt.hdlist1 + \-X <strategy-option> + %dt.hdlist1 + \--strategy-option=<strategy-option> + %dd + %p + Pass the <strategy-option> through to the merge strategy. + This implies + %tt --merge + and, if no strategy has been + specified, + = succeed "." do + %tt -s recursive + Note the reversal of + %em ours + and + %em theirs + as noted in above for the + %tt -m + option. + %dt.hdlist1 + \-q + %dt.hdlist1 + \--quiet + %dd + %p + Be quiet. Implies --no-stat. + %dt.hdlist1 + \-v + %dt.hdlist1 + \--verbose + %dd + %p + Be verbose. Implies --stat. + %dt.hdlist1 + \--stat + %dd + %p + Show a diffstat of what changed upstream since the last rebase. The + diffstat is also controlled by the configuration option rebase.stat. + %dt.hdlist1 + \-n + %dt.hdlist1 + \--no-stat + %dd + %p + Do not show a diffstat as part of the rebase process. + %dt.hdlist1 + \--no-verify + %dd + %p + This option bypasses the pre-rebase hook. See also + = succeed "." do + %a{:href => "githooks.html"} githooks(5) + %dt.hdlist1 + \--verify + %dd + %p + Allows the pre-rebase hook to run, which is the default. This option can + be used to override --no-verify. See also + = succeed "." do + %a{:href => "githooks.html"} githooks(5) + %dt.hdlist1 + \-C<n> + %dd + %p + Ensure at least <n> lines of surrounding context match before + and after each change. When fewer lines of surrounding + context exist they all must match. By default no context is + ever ignored. + %dt.hdlist1 + \-f + %dt.hdlist1 + \--force-rebase + %dd + %p + Force the rebase even if the current branch is a descendant + of the commit you are rebasing onto. Normally non-interactive rebase will + exit with the message "Current branch is up to date" in such a + situation. + Incompatible with the --interactive option. + .paragraph + %p + You may find this (or --no-ff with an interactive rebase) helpful after + reverting a topic branch merge, as this option recreates the topic branch with + fresh commits so it can be remerged successfully without needing to "revert + the reversion" (see the + %a{:href => "howto/revert-a-faulty-merge.txt"} revert-a-faulty-merge How-To + for details). + %dt.hdlist1 + \--ignore-whitespace + %dt.hdlist1 + \--whitespace=<option> + %dd + %p + These flag are passed to the + %em git apply + program + (see + = succeed ")" do + %a{:href => "git-apply.html"} git-apply(1) + that applies the patch. + Incompatible with the --interactive option. + %dt.hdlist1 + \--committer-date-is-author-date + %dt.hdlist1 + \--ignore-date + %dd + %p + These flags are passed to + %em git am + to easily change the dates + of the rebased commits (see + = succeed ")." do + %a{:href => "git-am.html"} git-am(1) + Incompatible with the --interactive option. + %dt.hdlist1 + \-i + %dt.hdlist1 + \--interactive + %dd + %p + Make a list of the commits which are about to be rebased. Let the + user edit that list before rebasing. This mode can also be used to + split commits (see SPLITTING COMMITS below). + %dt.hdlist1 + \-p + %dt.hdlist1 + \--preserve-merges + %dd + %p + Instead of ignoring merges, try to recreate them. + .paragraph + %p + This uses the + %tt --interactive + machinery internally, but combining it + with the + %tt --interactive + option explicitly is generally not a good + idea unless you know what you are doing (see BUGS below). + %dt.hdlist1 + \--root + %dd + %p + Rebase all commits reachable from <branch>, instead of + limiting them with an <upstream>. This allows you to rebase + the root commit(s) on a branch. Must be used with --onto, and + will skip changes already contained in <newbase> (instead of + \<upstream>). When used together with --preserve-merges, + %em all + root commits will be rewritten to have <newbase> as parent + instead. + %dt.hdlist1 + \--autosquash + %dt.hdlist1 + \--no-autosquash + %dd + %p + When the commit log message begins with "squash! …" (or + "fixup! …"), and there is a commit whose title begins with + the same …, automatically modify the todo list of rebase -i + so that the commit marked for squashing comes right after the + commit to be modified, and change the action of the moved + commit from + %tt pick + to + %tt squash + (or + = succeed ")." do + %tt fixup + .paragraph + %p + This option is only valid when the + %em --interactive + option is used. + .paragraph + %p + If the + %em --autosquash + option is enabled by default using the + configuration variable + = succeed "," do + %tt rebase.autosquash + this option can be + used to override and disable this setting. + %dt.hdlist1 + \--no-ff + %dd + %p + With --interactive, cherry-pick all rebased commits instead of + fast-forwarding over the unchanged ones. This ensures that the + entire history of the rebased branch is composed of new commits. + .paragraph + %p Without --interactive, this is a synonym for --force-rebase. + .paragraph + %p + You may find this helpful after reverting a topic branch merge, as this option + recreates the topic branch with fresh commits so it can be remerged + successfully without needing to "revert the reversion" (see the + %a{:href => "howto/revert-a-faulty-merge.txt"} revert-a-faulty-merge How-To + for details). + %h2#_merge_strategies MERGE STRATEGIES + .sectionbody + .paragraph + %p + The merge mechanism ( + %em git-merge + and + %em git-pull + commands) allows the + backend + %em merge strategies + to be chosen with + %tt -s + option. Some strategies + can also take their own options, which can be passed by giving + %tt -X<option> + arguments to + %em git-merge + and/or + = succeed "." do + %em git-pull + .dlist + %dl + %dt.hdlist1 + resolve + %dd + %p + This can only resolve two heads (i.e. the current branch + and another branch you pulled from) using a 3-way merge + algorithm. It tries to carefully detect criss-cross + merge ambiguities and is considered generally safe and + fast. + %dt.hdlist1 + recursive + %dd + %p + This can only resolve two heads using a 3-way merge + algorithm. When there is more than one common + ancestor that can be used for 3-way merge, it creates a + merged tree of the common ancestors and uses that as + the reference tree for the 3-way merge. This has been + reported to result in fewer merge conflicts without + causing mis-merges by tests done on actual merge commits + taken from Linux 2.6 kernel development history. + Additionally this can detect and handle merges involving + renames. This is the default merge strategy when + pulling or merging one branch. + .paragraph + %p + The + %em recursive + strategy can take the following options: + .dlist + %dl + %dt.hdlist1 + ours + %dd + %p + This option forces conflicting hunks to be auto-resolved cleanly by + favoring + %em our + version. Changes from the other tree that do not + conflict with our side are reflected to the merge result. + .paragraph + %p + This should not be confused with the + %em ours + merge strategy, which does not + even look at what the other tree contains at all. It discards everything + the other tree did, declaring + %em our + history contains all that happened in it. + %dt.hdlist1 + theirs + %dd + %p + This is opposite of + = succeed "." do + %em ours + %dt.hdlist1 + patience + %dd + %p + With this option, + %em merge-recursive + spends a little extra time + to avoid mismerges that sometimes occur due to unimportant + matching lines (e.g., braces from distinct functions). Use + this when the branches to be merged have diverged wildly. + See also + %a{:href => "git-diff.html"} git-diff(1) + = succeed "." do + %tt --patience + %dt.hdlist1 + ignore-space-change + %dt.hdlist1 + ignore-all-space + %dt.hdlist1 + ignore-space-at-eol + %dd + %p + Treats lines with the indicated type of whitespace change as + unchanged for the sake of a three-way merge. Whitespace + changes mixed with other changes to a line are not ignored. + See also + %a{:href => "git-diff.html"} git-diff(1) + = succeed "," do + %tt -b + = succeed "," do + %tt -w + and + = succeed "." do + %tt --ignore-space-at-eol + .ulist + %ul + %li + %p + If + %em their + version only introduces whitespace changes to a line, + %em our + version is used; + %li + %p + If + %em our + version introduces whitespace changes but + %em their + version includes a substantial change, + %em their + version is used; + %li + %p + Otherwise, the merge proceeds in the usual way. + %dt.hdlist1 + renormalize + %dd + %p + This runs a virtual check-out and check-in of all three stages + of a file when resolving a three-way merge. This option is + meant to be used when merging branches with different clean + filters or end-of-line normalization rules. See "Merging + branches with differing checkin/checkout attributes" in + %a{:href => "gitattributes.html"} gitattributes(5) + for details. + %dt.hdlist1 + no-renormalize + %dd + %p + Disables the + %tt renormalize + option. This overrides the + %tt merge.renormalize + configuration variable. + %dt.hdlist1 + rename-threshold=<n> + %dd + %p + Controls the similarity threshold used for rename detection. + See also + %a{:href => "git-diff.html"} git-diff(1) + = succeed "." do + %tt -M + %dt.hdlist1 + subtree[=<path>] + %dd + %p + This option is a more advanced form of + %em subtree + strategy, where + the strategy makes a guess on how two trees must be shifted to + match with each other when merging. Instead, the specified path + is prefixed (or stripped from the beginning) to make the shape of + two trees to match. + %dt.hdlist1 + octopus + %dd + %p + This resolves cases with more than two heads, but refuses to do + a complex merge that needs manual resolution. It is + primarily meant to be used for bundling topic branch + heads together. This is the default merge strategy when + pulling or merging more than one branch. + %dt.hdlist1 + ours + %dd + %p + This resolves any number of heads, but the resulting tree of the + merge is always that of the current branch head, effectively + ignoring all changes from all other branches. It is meant to + be used to supersede old development history of side + branches. Note that this is different from the -Xours option to + the + %em recursive + merge strategy. + %dt.hdlist1 + subtree + %dd + %p + This is a modified recursive strategy. When merging trees A and + B, if B corresponds to a subtree of A, B is first adjusted to + match the tree structure of A, instead of reading the trees at + the same level. This adjustment is also done to the common + ancestor tree. + %h2#_notes NOTES + .sectionbody + .paragraph + %p + You should understand the implications of using + %em git rebase + on a + repository that you share. See also RECOVERING FROM UPSTREAM REBASE + below. + .paragraph + %p + When the git-rebase command is run, it will first execute a "pre-rebase" + hook if one exists. You can use this hook to do sanity checks and + reject the rebase if it isn’t appropriate. Please see the template + pre-rebase hook script for an example. + .paragraph + %p Upon completion, <branch> will be the current branch. + %h2#_interactive_mode INTERACTIVE MODE + .sectionbody + .paragraph + %p + Rebasing interactively means that you have a chance to edit the commits + which are rebased. You can reorder the commits, and you can + remove them (weeding out bad or otherwise unwanted patches). + .paragraph + %p The interactive mode is meant for this type of workflow: + .olist.arabic + %ol.arabic + %li + %p + have a wonderful idea + %li + %p + hack on the code + %li + %p + prepare a series for submission + %li + %p + submit + .paragraph + %p where point 2. consists of several instances of + .olist.loweralpha + %ol.loweralpha + %li + %p + regular use + .olist.arabic + %ol.arabic + %li + %p + finish something worthy of a commit + %li + %p + commit + %li + %p + independent fixup + .olist.arabic + %ol.arabic + %li + %p + realize that something does not work + %li + %p + fix that + %li + %p + commit it + .paragraph + %p + Sometimes the thing fixed in b.2. cannot be amended to the not-quite + perfect commit it fixes, because that commit is buried deeply in a + patch series. That is exactly what interactive rebase is for: use it + after plenty of "a"s and "b"s, by rearranging and editing + commits, and squashing multiple commits into one. + .paragraph + %p Start it with the last commit you want to retain as-is: + .literalblock + .content + %pre + %tt git rebase -i <after-this-commit> + .paragraph + %p + An editor will be fired up with all the commits in your current branch + (ignoring merge commits), which come after the given commit. You can + reorder the commits in this list to your heart’s content, and you can + remove them. The list looks more or less like this: + .listingblock + .content + %pre + %tt + pick deadbee The oneline of this commit + pick fa1afe1 The oneline of the next commit + \... + .paragraph + %p + The oneline descriptions are purely for your pleasure; + %em git rebase + will + not look at them but at the commit names ("deadbee" and "fa1afe1" in this + example), so do not delete or edit the names. + .paragraph + %p + By replacing the command "pick" with the command "edit", you can tell + %em git rebase + to stop after applying that commit, so that you can edit + the files and/or the commit message, amend the commit, and continue + rebasing. + .paragraph + %p + If you just want to edit the commit message for a commit, replace the + command "pick" with the command "reword". + .paragraph + %p + If you want to fold two or more commits into one, replace the command + "pick" for the second and subsequent commits with "squash" or "fixup". + If the commits had different authors, the folded commit will be + attributed to the author of the first commit. The suggested commit + message for the folded commit is the concatenation of the commit + messages of the first commit and of those with the "squash" command, + but omits the commit messages of commits with the "fixup" command. + .paragraph + %p + %em git rebase + will stop when "pick" has been replaced with "edit" or + when a command fails due to merge errors. When you are done editing + and/or resolving conflicts you can continue with + = succeed "." do + %tt git rebase --continue + .paragraph + %p + For example, if you want to reorder the last 5 commits, such that what + was HEAD~4 becomes the new HEAD. To achieve that, you would call + %em git rebase + like this: + .listingblock + .content + %pre + %tt $ git rebase -i HEAD~5 + .paragraph + %p And move the first patch to the end of the list. + .paragraph + %p You might want to preserve merges, if you have a history like this: + .listingblock + .content + %pre + %tt + X + \\ + A---M---B + \/ + \---o---O---P---Q + .paragraph + %p + Suppose you want to rebase the side branch starting at "A" to "Q". Make + sure that the current HEAD is "B", and call + .listingblock + .content + %pre + %tt $ git rebase -i -p --onto Q O + .paragraph + %p + Reordering and editing commits usually creates untested intermediate + steps. You may want to check that your history editing did not break + anything by running a test, or at least recompiling at intermediate + points in history by using the "exec" command (shortcut "x"). You may + do so by creating a todo list like this one: + .listingblock + .content + %pre + %tt + pick deadbee Implement feature XXX + fixup f1a5c00 Fix to feature XXX + exec make + pick c0ffeee The oneline of the next commit + edit deadbab The oneline of the commit after + exec cd subdir; make test + \... + .paragraph + %p + The interactive rebase will stop when a command fails (i.e. exits with + non-0 status) to give you an opportunity to fix the problem. You can + continue with + = succeed "." do + %tt git rebase --continue + .paragraph + %p + The "exec" command launches the command in a shell (the one specified + in + = succeed "," do + %tt $SHELL + or the default shell if + %tt $SHELL + is not set), so you can + use shell features (like "cd", ">", ";" …). The command is run from + the root of the working tree. + %h2#_splitting_commits SPLITTING COMMITS + .sectionbody + .paragraph + %p + In interactive mode, you can mark commits with the action "edit". However, + this does not necessarily mean that + %em git rebase + expects the result of this + edit to be exactly one commit. Indeed, you can undo the commit, or you can + add other commits. This can be used to split a commit into two: + .ulist + %ul + %li + %p + Start an interactive rebase with + = succeed "," do + %tt git rebase -i <commit>^ + where + \<commit> is the commit you want to split. In fact, any commit range + will do, as long as it contains that commit. + %li + %p + Mark the commit you want to split with the action "edit". + %li + %p + When it comes to editing that commit, execute + = succeed "." do + %tt git reset HEAD^ + The + effect is that the HEAD is rewound by one, and the index follows suit. + However, the working tree stays the same. + %li + %p + Now add the changes to the index that you want to have in the first + commit. You can use + %tt git add + (possibly interactively) or + %em git gui + (or both) to do that. + %li + %p + Commit the now-current index with whatever commit message is appropriate + now. + %li + %p + Repeat the last two steps until your working tree is clean. + %li + %p + Continue the rebase with + = succeed "." do + %tt git rebase --continue + .paragraph + %p + If you are not absolutely sure that the intermediate revisions are + consistent (they compile, pass the testsuite, etc.) you should use + %em git stash + to stash away the not-yet-committed changes + after each commit, test, and amend the commit if fixes are necessary. + %h2#_recovering_from_upstream_rebase RECOVERING FROM UPSTREAM REBASE + .sectionbody + .paragraph + %p + Rebasing (or any other form of rewriting) a branch that others have + based work on is a bad idea: anyone downstream of it is forced to + manually fix their history. This section explains how to do the fix + from the downstream’s point of view. The real fix, however, would be + to avoid rebasing the upstream in the first place. + .paragraph + %p + To illustrate, suppose you are in a situation where someone develops a + %em subsystem + branch, and you are working on a + %em topic + that is dependent + on this + = succeed "." do + %em subsystem + You might end up with a history like the + following: + .listingblock + .content + %pre + %tt + o---o---o---o---o---o---o---o---o master + \\ + o---o---o---o---o subsystem + \\ + *---*---* topic + .paragraph + %p + If + %em subsystem + is rebased against + = succeed "," do + %em master + the following happens: + .listingblock + .content + %pre + %tt + o---o---o---o---o---o---o---o master + \\ \ + o---o---o---o---o o'--o'--o'--o'--o' subsystem + \\ + *---*---* topic + .paragraph + %p + If you now continue development as usual, and eventually merge + %em topic + to + = succeed "," do + %em subsystem + the commits from + %em subsystem + will remain duplicated forever: + .listingblock + .content + %pre + %tt + o---o---o---o---o---o---o---o master + \\ \ + o---o---o---o---o o'--o'--o'--o'--o'--M subsystem + \\ / + *---*---*-..........-*--* topic + .paragraph + %p + Such duplicates are generally frowned upon because they clutter up + history, making it harder to follow. To clean things up, you need to + transplant the commits on + %em topic + to the new + %em subsystem + tip, i.e., + rebase + = succeed "." do + %em topic + This becomes a ripple effect: anyone downstream from + %em topic + is forced to rebase too, and so on! + .paragraph + %p There are two kinds of fixes, discussed in the following subsections: + .dlist + %dl + %dt.hdlist1 + Easy case: The changes are literally the same. + %dd + %p + This happens if the + %em subsystem + rebase was a simple rebase and + had no conflicts. + %dt.hdlist1 + Hard case: The changes are not the same. + %dd + %p + This happens if the + %em subsystem + rebase had conflicts, or used + %tt --interactive + to omit, edit, squash, or fixup commits; or + if the upstream used one of + = succeed "," do + %tt commit --amend + = succeed "," do + %tt reset + or + = succeed "." do + %tt filter-branch + %h3#_the_easy_case The easy case + %div{:style => "clear:left"} + .paragraph + %p + Only works if the changes (patch IDs based on the diff contents) on + %em subsystem + are literally the same before and after the rebase + %em subsystem + did. + .paragraph + %p + In that case, the fix is easy because + %em git rebase + knows to skip + changes that are already present in the new upstream. So if you say + (assuming you’re on + = succeed ")" do + %em topic + .listingblock + .content + %pre + %tt $ git rebase subsystem + .paragraph + %p you will end up with the fixed history + .listingblock + .content + %pre + %tt + o---o---o---o---o---o---o---o master + \\ + o'--o'--o'--o'--o' subsystem + \\ + *---*---* topic + %h3#_the_hard_case The hard case + %div{:style => "clear:left"} + .paragraph + %p + Things get more complicated if the + %em subsystem + changes do not exactly + correspond to the ones before the rebase. + .admonitionblock + %table + %tr + %td.icon + .title Note + %td.content + While an "easy case recovery" sometimes appears to be successful + even in the hard case, it may have unintended consequences. For + example, a commit that was removed via + %tt + git rebase + \--interactive + will be + = succeed "!" do + %strong resurrected + .paragraph + %p + The idea is to manually tell + %em git rebase + "where the old + %em subsystem + ended and your + %em topic + began", that is, what the old merge-base + between them was. You will have to find a way to name the last commit + of the old + = succeed "," do + %em subsystem + for example: + .ulist + %ul + %li + %p + With the + %em subsystem + reflog: after + = succeed "," do + %em git fetch + the old tip of + %em subsystem + is at + = succeed "." do + %tt subsystem@{1} + Subsequent fetches will + increase the number. (See + = succeed ".)" do + %a{:href => "git-reflog.html"} git-reflog(1) + %li + %p + Relative to the tip of + = succeed ":" do + %em topic + knowing that your + %em topic + has three + commits, the old tip of + %em subsystem + must be + = succeed "." do + %tt topic~3 + .paragraph + %p + You can then transplant the old + %tt subsystem..topic + to the new tip by + saying (for the reflog case, and assuming you are on + %em topic + already): + .listingblock + .content + %pre + %tt $ git rebase --onto subsystem subsystem@{1} + .paragraph + %p + The ripple effect of a "hard case" recovery is especially bad: + %em everyone + downstream from + %em topic + will now have to perform a "hard + case" recovery too! + %h2#_bugs BUGS + .sectionbody + .paragraph + %p + The todo list presented by + %tt --preserve-merges --interactive + does not + represent the topology of the revision graph. Editing commits and + rewording their commit messages should work fine, but attempts to + reorder commits tend to produce counterintuitive results. + .paragraph + %p For example, an attempt to rearrange + .listingblock + .content + %pre + %tt 1 --- 2 --- 3 --- 4 --- 5 + .paragraph + %p to + .listingblock + .content + %pre + %tt 1 --- 2 --- 4 --- 3 --- 5 + .paragraph + %p by moving the "pick 4" line will result in the following history: + .listingblock + .content + %pre + %tt + 3 + \/ + 1 --- 2 --- 4 --- 5 + %h2#_git GIT + .sectionbody + .paragraph + %p + Part of the + %a{:href => "git.html"} git(1) + suite + #footer + #footer-text + Last updated 2011-07-23 00:49:30 UTC diff --git a/app/views/doc/_topics.html.erb b/app/views/doc/_topics.html.erb deleted file mode 100644 index a387a21021..0000000000 --- a/app/views/doc/_topics.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -Topics ▾ - diff --git a/app/views/doc/_topics.html.haml b/app/views/doc/_topics.html.haml new file mode 100644 index 0000000000..a37a075ddf --- /dev/null +++ b/app/views/doc/_topics.html.haml @@ -0,0 +1,19 @@ +%a#reference-topics-trigger.dropdown-trigger{"data-panel-id" => "topics-dropdown", :href => "#"} Topics ▾ +#topics-dropdown.dropdown-panel.right + .three-column + .column-left + = render 'shared/ref/setup' + = render 'shared/ref/creating' + = render 'shared/ref/snapshot' + = render 'shared/ref/branching' + = render 'shared/ref/sharing' + .column-middle + = render 'shared/ref/inspection' + = render 'shared/ref/patching' + = render 'shared/ref/debugging' + = render 'shared/ref/email' + = render 'shared/ref/external' + .column-right + = render 'shared/ref/admin' + = render 'shared/ref/server' + = render 'shared/ref/plumbing' diff --git a/app/views/doc/_translations.html.erb b/app/views/doc/_translations.html.erb deleted file mode 100644 index eb3a7a65d1..0000000000 --- a/app/views/doc/_translations.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -

-This book is translated into - German, - Chinese, - French, - Japanese and - Dutch. -

- -

-Partial translations available in - Arabic, - Czech, - Spanish, - Indonesian, - Italian, - Macedonian, - Polish, - Thai and - Russian. -

- - diff --git a/app/views/doc/_translations.html.haml b/app/views/doc/_translations.html.haml new file mode 100644 index 0000000000..2ad6f48ab0 --- /dev/null +++ b/app/views/doc/_translations.html.haml @@ -0,0 +1,33 @@ +%p + This book is translated into + = succeed "," do + %a{:href => "/book/de"} German + = succeed "," do + %a{:href => "/book/zh"} Chinese + = succeed "," do + %a{:href => "/book/fr"} French + %a{:href => "/book/ja"} Japanese + and + = succeed "." do + %a{:href => "/book/nl"} Dutch +%p + Partial translations available in + = succeed "," do + %a{:href => "/book/ar"} Arabic + = succeed "," do + %a{:href => "/book/cs"} Czech + = succeed "," do + %a{:href => "/book/es"} Spanish + = succeed "," do + %a{:href => "/book/id"} Indonesian + = succeed "," do + %a{:href => "/book/it"} Italian + = succeed "," do + %a{:href => "/book/mk"} Macedonian + = succeed "," do + %a{:href => "/book/pl"} Polish + %a{:href => "/book/th"} Thai + and + = succeed "." do + %a{:href => "/book/ru"} Russian +%hr.sidebar/ diff --git a/app/views/doc/_versions.html.erb b/app/views/doc/_versions.html.erb deleted file mode 100644 index aa910ae043..0000000000 --- a/app/views/doc/_versions.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -Version <%= @version.name %> ▾ -<%= @file.name %> last updated in <%= @last.version.name %> - diff --git a/app/views/doc/_versions.html.haml b/app/views/doc/_versions.html.haml new file mode 100644 index 0000000000..14b31d1a81 --- /dev/null +++ b/app/views/doc/_versions.html.haml @@ -0,0 +1,35 @@ +%a#reference-versions-trigger.dropdown-trigger{"data-panel-id" => "previous-versions-dropdown", :href => "#"} + Version #{@version.name} ▾ +%span.light + = @file.name + last updated in #{@last.version.name} +#previous-versions-dropdown.dropdown-panel.left + %header + Changes in the + %strong= @file.name + manual + %ol.reference-previous-versions + - @versions.each do |v| + - if v[:changed] + %li + %a{:href => "/docs/#{@file.name}/#{v[:name]}"} + %span.version= v[:name] + %span.diff + - v[:diff][0].times do + %img{:src => "/images/icons/green-dot.png"}/ + - v[:diff][1].times do + %img{:src => "/images/icons/red-dot.png"}/ + - v[:diff][2].times do + %img{:src => "/images/icons/grey-dot.png"}/ + %em.date= v[:time].strftime("%m/%d/%y") + - else + %li.no-change + %span= raw v[:name] + %li   + /
  • See more previous releases →
  • + %footer + %span.light + Check your version of git by running + %br/ + %strong $ + %input.copyable{:type => "text", :value => "git --version"}/ diff --git a/app/views/doc/blog.html.erb b/app/views/doc/blog.html.erb deleted file mode 100644 index 4e2df25b2f..0000000000 --- a/app/views/doc/blog.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% @section = 'documentation' %> -<% @subsection = 'book' %> - -
    -

    <%= @frontmatter['title'] %>

    - <%=raw @content %> -
    diff --git a/app/views/doc/blog.html.haml b/app/views/doc/blog.html.haml new file mode 100644 index 0000000000..4d18a1af9c --- /dev/null +++ b/app/views/doc/blog.html.haml @@ -0,0 +1,5 @@ +- @section = 'documentation' +- @subsection = 'book' +#main.book + %h1= @frontmatter['title'] + = raw @content diff --git a/app/views/doc/book.html.erb b/app/views/doc/book.html.erb deleted file mode 100644 index 1ff1a93c3f..0000000000 --- a/app/views/doc/book.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<%- @section = 'documentation' %> -<%- @subsection = 'book' %> -<%- @page_title = "Git - Book" %> - -<% content_for :sidebar do %> - <%= render 'ebooks' %> - <%= render 'translations' %> -<% end %> - -
    -

    Book

    - -

    - The entire Pro Git book, written by Scott Chacon and published by Apress, is available here. All content is licensed under the Creative Commons Attribution Non Commercial Share Alike 3.0 license. Print versions of the book are available on Amazon.com. -

    -
      - <% @book.chapters.each do |chapter| %> -
    1. -

      <%= chapter.number %>. <%=raw chapter.title %>

      -
        - <% chapter.sections.each do |section| %> - <% if !section.title.empty? %> -
      1. - <%= chapter.number %>.<%= section.number %> - <%=raw section.title %> -
      2. - <% end %> - <% end %> -
      -
    2. - <% end %> -
    3. -

      Index of Commands

      -
    4. -
    -
    - diff --git a/app/views/doc/book.html.haml b/app/views/doc/book.html.haml new file mode 100644 index 0000000000..ea71699b43 --- /dev/null +++ b/app/views/doc/book.html.haml @@ -0,0 +1,31 @@ +- @section = 'documentation' +- @subsection = 'book' +- @page_title = "Git - Book" +- content_for :sidebar do + = render 'ebooks' + = render 'translations' +#main + %h1 Book + %img{:src => "/images/pro-git-118x157.jpg", :style => "float:right;margin: -20px 40px 0 40px;"}/ + %p + The entire Pro Git book, written by Scott Chacon and published by Apress, is available here. All content is licensed under the + = succeed "." do + %a{:href => "http://creativecommons.org/licenses/by-nc-sa/3.0/"} Creative Commons Attribution Non Commercial Share Alike 3.0 license + Print versions of the book are available on + = succeed "." do + %a{:href => "http://www.amazon.com/gp/product/1430218339?ie=UTF8&tag=prgi-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=1430218339"} Amazon.com + %ol.book-toc + - @book.chapters.each do |chapter| + %li.chapter + %h2 + == #{chapter.number}. + %a{:href => "/book/#{@book.code}/#{chapter.sections.first.slug}"}= raw chapter.title + %ol + - chapter.sections.each do |section| + - if !section.title.empty? + %li + == #{chapter.number}.#{section.number} + %a{:href => "/book/#{@book.code}/#{section.slug}"}= raw section.title + %li.chapter + %h2 + %a{:href => "/book/commands"} Index of Commands diff --git a/app/views/doc/book_section.html.erb b/app/views/doc/book_section.html.erb deleted file mode 100644 index ca8b514e7c..0000000000 --- a/app/views/doc/book_section.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% @section = 'documentation' %> -<% @subsection = 'book' %> - -<% content_for :sidebar do %> - <%= render 'ebooks' %> - <%= render 'translations' %> - <%= render 'shared/related' %> -<% end %> - -
    - <% if !@content.title.empty? %> -

    <%= @content.cs_number %> <%=raw @content.chapter.title %> - <%=raw @content.title %>

    - <% end %> -
    <%=raw linkify(@content.html, @content) %>
    -
    diff --git a/app/views/doc/book_section.html.haml b/app/views/doc/book_section.html.haml new file mode 100644 index 0000000000..890b2a59aa --- /dev/null +++ b/app/views/doc/book_section.html.haml @@ -0,0 +1,13 @@ +- @section = 'documentation' +- @subsection = 'book' +- content_for :sidebar do + = render 'ebooks' + = render 'translations' + = render 'shared/related' +#main.book + - if !@content.title.empty? + %h1 + = @content.cs_number + = raw @content.chapter.title + \- #{raw @content.title} + %div= raw linkify(@content.html, @content) diff --git a/app/views/doc/commands.html.erb b/app/views/doc/commands.html.erb deleted file mode 100644 index 02f6142b24..0000000000 --- a/app/views/doc/commands.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<% @section = 'documentation' %> -<% @subsection = 'book' %> - -
    -

    Index of Commands

    - - <% @groups.each do |title, commands| %> - - - - <% commands.each do |cmd| %> - - - - <% if @related[cmd] %> - <% count = 0 %> - <% @related[cmd].each do |number, slug, score| %> - <% count += 1 %> - <% if count > 10 %> - <% count = 1 %> - - <% end %> - - <% end %> - <% end %> - - <% end %> - <% end %> -

    <%= title %>

     <%= cmd %>
     <%= number %> (<%= score %>)
    -
    diff --git a/app/views/doc/commands.html.haml b/app/views/doc/commands.html.haml new file mode 100644 index 0000000000..cb3962d8ea --- /dev/null +++ b/app/views/doc/commands.html.haml @@ -0,0 +1,26 @@ +- @section = 'documentation' +- @subsection = 'book' +#main.book + %h1 Index of Commands + %table.commands + - @groups.each do |title, commands| + %tr + %td{:colspan => "10"} + %h2= title + - commands.each do |cmd| + %tr + %th   + %th= cmd + - if @related[cmd] + - count = 0 + - @related[cmd].each do |number, slug, score| + - count += 1 + - if count > 10 + - count = 1 + %tr + %th   + %td + %td{:nowrap => ""} + %a{:href => "/book/en/#{slug}"}= number + %small + (#{score}) diff --git a/app/views/doc/ext.html.erb b/app/views/doc/ext.html.erb deleted file mode 100644 index 921fa36cf9..0000000000 --- a/app/views/doc/ext.html.erb +++ /dev/null @@ -1,140 +0,0 @@ -<%- @section = 'documentation' %> -<%- @subsection = 'external-links' %> -<%- @page_title = 'Git - External Links' %> - -
    -

    External Links

    -

    Tutorials

    -
    -
    -

    Short & Sweet

    - -
    -
    -

    Diving Deeper

    -
      -
    • -

      Git for Designers

      -

      - No knowledge of version control? No problem. -

      -
    • -
    • -

      Git for Computer Scientists

      -

      - A quick introduction to Git internals for people who aren't scared by words like Directed Acyclic Graph. -

      -
    • -
    • -

      Git Magic

      -

      - An alternative book with the source online. -

      -
    • -
    • -

      Help.GitHub

      -

      - Guides on a variety of Git and GitHub related topics. -

      -
    • -
    -
    -
    -

    Books

    -
    -
    - -
    -
    - -
    -
    -

    Videos

    -
    -
    - -
    -
    -
      -
    • - -

      Introduction to Git: Scott Chacon

      -

      - This talk introduces the Git Version Control System by looking at what Git is doing when you run the commands you need to do basic version control with it. -

      -
    • -
    -
    -
    -
    diff --git a/app/views/doc/ext.html.haml b/app/views/doc/ext.html.haml new file mode 100644 index 0000000000..61062840a8 --- /dev/null +++ b/app/views/doc/ext.html.haml @@ -0,0 +1,117 @@ +- @section = 'documentation' +- @subsection = 'external-links' +- @page_title = 'Git - External Links' +#main + %h1 External Links + %h2 Tutorials + .two-column + .column-left + %h3 Short & Sweet + %ul.content-list + %li + %h4 + %a{:href => "http://gitref.org/"} Introductory Reference & Tutorial + %p.description + This introductory walkthrough acts as a nice tutorial. + %li + %h4 + %a{:href => "/docs/gittutorial"} Official Git Tutorial + %p.description + The official gittutorial man page is a good place to start. + %li + %h4 + %a{:href => "/docs/everyday"} Everyday Git + %p.description + Learn the basics with 20 of the most common commands. + %li + %h4 + %a{:href => "http://gitimmersion.com/"} Git Immersion + %p.description + A guided tour that walks through the fundamentals of Git. + .column-right + %h3 Diving Deeper + %ul.content-list + %li + %h4 + %a{:href => "http://hoth.entp.com/output/git_for_designers.html"} Git for Designers + %p.description + No knowledge of version control? No problem. + %li + %h4 + %a{:href => "http://eagain.net/articles/git-for-computer-scientists/"} Git for Computer Scientists + %p.description + A quick introduction to Git internals for people who aren't scared by words like Directed Acyclic Graph. + %li + %h4 + %a{:href => "http://www-cs-students.stanford.edu/~blynn/gitmagic/"} Git Magic + %p.description + An alternative book with the source + = succeed "." do + %a{:href => "http://github.com/blynn/gitmagic/tree/master"} online + %li + %h4 + %a{:href => "http://help.github.com/"} Help.GitHub + %p.description + Guides on a variety of Git and GitHub related topics. + %h2 Books + .two-column + .column-left + %ul.books-list + %li + %a{:href => "http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git"} + %img{:src => "/images/books/pragmatic-version-control.jpg"}/ + %h4 + %a{:href => "http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git"} Pragmatic Version Control Using Git + %p.description + By Travis Swicegood + %li + %a{:href => "/book"} + %img{:src => "/images/books/pro-git.jpg"}/ + %h4 + %a{:href => "/book"} Pro Git + %p.description + By Scott Chacon + %img.creative-commons{:src => "/images/creative-commons.png"}/ + %li + %a{:href => "http://peepcode.com/products/git-internals-pdf"} + %img{:src => "/images/books/git-internals.jpg"}/ + %h4 + %a{:href => "http://peepcode.com/products/git-internals-pdf"} Git Internals Peepcode PDF + %p.description + By Scott Chacon + .column-right + %ul.books-list + %li + %a{:href => "http://www.amazon.com/Version-Control-Git-collaborative-development/dp/0596520123"} + %img{:src => "/images/books/version-control-with-git.jpg"}/ + %h4 + %a{:href => "http://www.amazon.com/Version-Control-Git-collaborative-development/dp/0596520123"} Version Control with Git + %p.description + By Jon Loeliger + %li + %a{:href => "http://www.pragprog.com/titles/pg_git/pragmatic-guide-to-git"} + %img{:src => "/images/books/pragmatic-guide-to-git.jpg"}/ + %h4 + %a{:href => "http://www.pragprog.com/titles/pg_git/pragmatic-guide-to-git"} Pragmatic Guide to Git + %p.description + By Travis Swicegood + %h2 Videos + .two-column + .column-left + %ul.video-thumbnails + %li + %a{:href => "http://www.youtube.com/watch?v=4XpnKHJAok8"} + %img{:src => "/images/videos/linus.jpg"}/ + %h4 + %a{:href => "http://www.youtube.com/watch?v=4XpnKHJAok8"} Tech Talk: Linus Torvalds on Git + %p.description + Linus Torvalds visits Google to share his thoughts on Git, the SCM system he created. + .column-right + %ul.video-thumbnails + %li + %a{:href => "http://www.youtube.com/watch?v=ZDR433b0HJY"} + %img{:src => "/images/videos/introgit.png"}/ + %h4 + %a{:href => "http://www.youtube.com/watch?v=ZDR433b0HJY"} Introduction to Git: Scott Chacon + %p.description + This talk introduces the Git Version Control System by looking at what Git is doing when you run the commands you need to do basic version control with it. diff --git a/app/views/doc/man.html.erb b/app/views/doc/man.html.erb deleted file mode 100644 index 00a42a6934..0000000000 --- a/app/views/doc/man.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<% @section = 'documentation' %> -<% @subsection = 'reference' %> - -<% content_for :sidebar do %> - <%= cache("#{@cache_key}-related") do %> - <%= render 'shared/related' %> - <% end %> -<% end %> - -<%= cache(@cache_key) do %> -
    - <%= render 'doc/topics' %> - <%= render 'doc/versions' %> -
    - -
    - <%=raw @doc.html %> -
    -<% end %> diff --git a/app/views/doc/man.html.haml b/app/views/doc/man.html.haml new file mode 100644 index 0000000000..df42af94d9 --- /dev/null +++ b/app/views/doc/man.html.haml @@ -0,0 +1,12 @@ +- @section = 'documentation' +- @subsection = 'reference' +- content_for :sidebar do + = cache("#{@cache_key}-related") do + = render 'shared/related' += cache(@cache_key) do + #reference-version + = render 'doc/topics' + = render 'doc/versions' + #main + :erb + <%= raw @doc.html %> diff --git a/app/views/doc/ref.html.erb b/app/views/doc/ref.html.erb deleted file mode 100644 index 35bd4d93e1..0000000000 --- a/app/views/doc/ref.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<%- @section = 'documentation' %> -<%- @subsection = 'reference' %> -<%- @page_title = "Git - Reference" %> - -
    -

    Reference

    -
    -

    - Quick reference guides: - Heroku Cheat Sheet - (PDF)  |  - Visual Git Cheat Sheet - (SVG | PNG) -

    -
    -
    -
    -
    - <%= render 'shared/ref/setup' %> - <%= render 'shared/ref/creating' %> - <%= render 'shared/ref/snapshot' %> - <%= render 'shared/ref/branching' %> - <%= render 'shared/ref/sharing' %> - <%= render 'shared/ref/inspection' %> - <%= render 'shared/ref/patching' %> -
    -
    - <%= render 'shared/ref/debugging' %> - <%= render 'shared/ref/email' %> - <%= render 'shared/ref/external' %> - <%= render 'shared/ref/admin' %> - <%= render 'shared/ref/server' %> - <%= render 'shared/ref/plumbing' %> -
    -
    -
    -
    diff --git a/app/views/doc/ref.html.haml b/app/views/doc/ref.html.haml new file mode 100644 index 0000000000..76dccd2e3b --- /dev/null +++ b/app/views/doc/ref.html.haml @@ -0,0 +1,29 @@ +- @section = 'documentation' +- @subsection = 'reference' +- @page_title = "Git - Reference" +#main + %h1 Reference + .callout.quickref + %p + Quick reference guides: + %a{:href => " https://na1.salesforce.com/help/doc/en/salesforce_git_developer_cheatsheet.pdf"} Heroku Cheat Sheet + %small.light (PDF)  |  + %a{:href => "http://ndpsoftware.com/git-cheatsheet.html"} Visual Git Cheat Sheet + %small.light (SVG | PNG) + .reference-menu + .two-column + .column-left + = render 'shared/ref/setup' + = render 'shared/ref/creating' + = render 'shared/ref/snapshot' + = render 'shared/ref/branching' + = render 'shared/ref/sharing' + = render 'shared/ref/inspection' + = render 'shared/ref/patching' + .column-right + = render 'shared/ref/debugging' + = render 'shared/ref/email' + = render 'shared/ref/external' + = render 'shared/ref/admin' + = render 'shared/ref/server' + = render 'shared/ref/plumbing' diff --git a/app/views/doc/videos.html.erb b/app/views/doc/videos.html.erb deleted file mode 100644 index ba23ffd177..0000000000 --- a/app/views/doc/videos.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<%- @section = 'documentation' %> -<%- @subsection = 'videos' %> -<%- @page_title = 'Git - Videos' %> - -<% groups = @videos.group_by { |i| i[0] % 2 } %> - -
    -

    Videos

    -
    -
    -
      - <% groups[1].each do |video| %> -
    • - -

      <%= video[3] %>

      -

      - Length: <%= video[5] %> -

      -
    • - <% end %> -
    -
    -
    -
      - <% groups[0].each do |video| %> -
    • - -

      <%= video[3] %>

      -

      - Length: <%= video[5] %> -

      -
    • - <% end %> -
    -
    -
    -
    diff --git a/app/views/doc/videos.html.haml b/app/views/doc/videos.html.haml new file mode 100644 index 0000000000..3504120401 --- /dev/null +++ b/app/views/doc/videos.html.haml @@ -0,0 +1,29 @@ +- @section = 'documentation' +- @subsection = 'videos' +- @page_title = 'Git - Videos' +- groups = @videos.group_by { |i| i[0] % 2 } +#main + %h1 Videos + .two-column + .column-left + %ul.video-thumbnails + - groups[1].each do |video| + %li + %a{:href => "/video/#{video[4]}"} + %img{:src => "/images/video/ep#{video[0]}.png"}/ + %h4 + %a{:href => "/video/#{video[4]}"}= video[3] + %p.description + %strong Length: + = video[5] + .column-right + %ul.video-thumbnails + - groups[0].each do |video| + %li + %a{:href => "/video/#{video[4]}"} + %img{:src => "/images/video/ep#{video[0]}.png"}/ + %h4 + %a{:href => "/video/#{video[4]}"}= video[3] + %p.description + %strong Length: + = video[5] diff --git a/app/views/downloads/download_linux.html.erb b/app/views/downloads/download_linux.html.erb deleted file mode 100644 index 96d540dd02..0000000000 --- a/app/views/downloads/download_linux.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<%- @section = "downloads" %> -<%- @subsection = "" %> - -
    -

    Download for Linux and Unix

    -

    It is easiest to install Git on Linux using the preferred package manager of your Linux distribution.

    - -

    Debian/Ubuntu

    - $ apt-get install git-core - -

    Fedora

    - $ yum install git - -

    Gentoo

    - $ emerge --ask --verbose dev-vcs/git - -

    FreeBSD

    - $ cd /usr/ports/devel/git
    $ make install
    - -

    Solaris 11 Express

    - $ pkg install developer/versioning/git - -

    OpenBSD

    - $ pkg_add git - -
    diff --git a/app/views/downloads/download_linux.html.haml b/app/views/downloads/download_linux.html.haml new file mode 100644 index 0000000000..9731117371 --- /dev/null +++ b/app/views/downloads/download_linux.html.haml @@ -0,0 +1,24 @@ +- @section = "downloads" +- @subsection = "" + +#main + %h1 Download for Linux and Unix + %p It is easiest to install Git on Linux using the preferred package manager of your Linux distribution. + + %h3 Debian/Ubuntu + %code $ apt-get install git-core + + %h3 Fedora + %code $ yum install git + + %h3 Gentoo + %code $ emerge --ask --verbose dev-vcs/git + + %h3 FreeBSD + %code $ cd /usr/ports/devel/git
    $ make install + + %h3 Solaris 11 Express + %code $ pkg install developer/versioning/git + + %h3 OpenBSD + %code $ pkg_add git \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 19917f9c84..0000000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<%= render 'shared/head' %> - -
    - <%= render 'shared/header' %> - <%= yield %> -
    - - - diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100644 index 0000000000..22e02d8e10 --- /dev/null +++ b/app/views/layouts/application.html.haml @@ -0,0 +1,7 @@ +!!! 5 +%html{:lang => "en"} + = render 'shared/head' + %body + .container + = render 'shared/header' + = yield diff --git a/app/views/shared/_book.html.erb b/app/views/shared/_book.html.erb deleted file mode 100644 index c4ea2fce0b..0000000000 --- a/app/views/shared/_book.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -
    -

    The entire Pro Git book written - by Scott Chacon is available to read online for free. - Dead tree versions are available on Amazon.com. -

    -
    diff --git a/app/views/shared/_book.html.haml b/app/views/shared/_book.html.haml new file mode 100644 index 0000000000..20dfeabc7e --- /dev/null +++ b/app/views/shared/_book.html.haml @@ -0,0 +1,5 @@ +.callout + %p + The entire Pro Git book written + by Scott Chacon is available to read online for free. + Dead tree versions are available on Amazon.com. diff --git a/app/views/shared/_head.html.erb b/app/views/shared/_head.html.erb deleted file mode 100644 index d5f7083d80..0000000000 --- a/app/views/shared/_head.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - - git-scm.com - <%= stylesheet_link_tag "git-scm", :media => "all" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - diff --git a/app/views/shared/_head.html.haml b/app/views/shared/_head.html.haml new file mode 100644 index 0000000000..9b9020b852 --- /dev/null +++ b/app/views/shared/_head.html.haml @@ -0,0 +1,5 @@ +%head + %title git-scm.com + = stylesheet_link_tag "git-scm", :media => "all" + = javascript_include_tag "application" + = csrf_meta_tags diff --git a/app/views/shared/_related.html.erb b/app/views/shared/_related.html.erb deleted file mode 100644 index 6bcf6c8a80..0000000000 --- a/app/views/shared/_related.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% if @related && @related.size > 0 %> -

    Related Material

    - -<% end %> diff --git a/app/views/shared/_related.html.haml b/app/views/shared/_related.html.haml index 09b1017b13..dffbbdd26a 100644 --- a/app/views/shared/_related.html.haml +++ b/app/views/shared/_related.html.haml @@ -1,31 +1,12 @@ -%h4 Related StackOverflow Questions - -%ul.stackoverflow - %li - =link_to "About Git's merge and rebase" - %span - 5 votes / 3 Answers - %li - =link_to "git rebase vs git merge" - %span - 81 votes / 5 Answers - %li - =link_to "How to do a rebase with git gui?" - %span - 5 votes / 3 Answers - %li - =link_to "recovering from git rebase" - %span - 27 votes / 15 Answers - %li - =link_to "git pull VS git fetch git rebase" - %span - 15 votes / 3 Answers - %li - =link_to "Undoing a git rebase" - %span - 160 votes / 7 Answers - %li - =link_to "How to know if there is a git rebase in progress?" - %span - 16 votes / 7 Answers +- if @related && @related.size > 0 + %h4 Related Material + %ul.related-material + - @related.each do |rel| + %li{:class => rel.content_type} + %strong=link_to rel.name, rel.content_url + - if rel.content_type == "reference" + in #{link_to "Reference", "/docs"} + - elsif rel.content_type == "book" + in #{link_to "Books", "/book/en"} + - elsif rel.content_type == "video" + in #{link_to "Videos", "/videos"} diff --git a/app/views/shared/_related.html.haml.bak b/app/views/shared/_related.html.haml.bak new file mode 100644 index 0000000000..09b1017b13 --- /dev/null +++ b/app/views/shared/_related.html.haml.bak @@ -0,0 +1,31 @@ +%h4 Related StackOverflow Questions + +%ul.stackoverflow + %li + =link_to "About Git's merge and rebase" + %span + 5 votes / 3 Answers + %li + =link_to "git rebase vs git merge" + %span + 81 votes / 5 Answers + %li + =link_to "How to do a rebase with git gui?" + %span + 5 votes / 3 Answers + %li + =link_to "recovering from git rebase" + %span + 27 votes / 15 Answers + %li + =link_to "git pull VS git fetch git rebase" + %span + 15 votes / 3 Answers + %li + =link_to "Undoing a git rebase" + %span + 160 votes / 7 Answers + %li + =link_to "How to know if there is a git rebase in progress?" + %span + 16 votes / 7 Answers diff --git a/app/views/shared/ref/_admin.html.erb b/app/views/shared/ref/_admin.html.erb deleted file mode 100644 index 9b9719d9c3..0000000000 --- a/app/views/shared/ref/_admin.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

    Administration

    - diff --git a/app/views/shared/ref/_admin.html.haml b/app/views/shared/ref/_admin.html.haml new file mode 100644 index 0000000000..5bf98c52cb --- /dev/null +++ b/app/views/shared/ref/_admin.html.haml @@ -0,0 +1,8 @@ +%h3.admin Administration +%ul.unstyled + %li= man('git-gc') + %li= man('git-fsck') + %li= man('git-reflog') + %li= man('git-filter-branch') + %li= man('git-instaweb') + %li= man('git-archive') diff --git a/app/views/shared/ref/_branching.html.erb b/app/views/shared/ref/_branching.html.erb deleted file mode 100644 index 9389b21a02..0000000000 --- a/app/views/shared/ref/_branching.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    Branching and Merging

    - diff --git a/app/views/shared/ref/_branching.html.haml b/app/views/shared/ref/_branching.html.haml new file mode 100644 index 0000000000..cf32912bda --- /dev/null +++ b/app/views/shared/ref/_branching.html.haml @@ -0,0 +1,9 @@ +%h3.branching Branching and Merging +%ul.unstyled + %li= man('git-branch') + %li= man('git-checkout') + %li= man('git-merge') + %li= man('git-mergetool') + %li= man('git-log') + %li= man('git-stash') + %li= man('git-tag') diff --git a/app/views/shared/ref/_creating.html.erb b/app/views/shared/ref/_creating.html.erb deleted file mode 100644 index e18d29bda6..0000000000 --- a/app/views/shared/ref/_creating.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

    Getting and Creating Projects

    - diff --git a/app/views/shared/ref/_creating.html.haml b/app/views/shared/ref/_creating.html.haml new file mode 100644 index 0000000000..1cd7774903 --- /dev/null +++ b/app/views/shared/ref/_creating.html.haml @@ -0,0 +1,4 @@ +%h3.projects Getting and Creating Projects +%ul.unstyled + %li= man('git-init') + %li= man('git-clone') diff --git a/app/views/shared/ref/_debugging.html.erb b/app/views/shared/ref/_debugging.html.erb deleted file mode 100644 index a14e7077ad..0000000000 --- a/app/views/shared/ref/_debugging.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

    Debugging

    - diff --git a/app/views/shared/ref/_debugging.html.haml b/app/views/shared/ref/_debugging.html.haml new file mode 100644 index 0000000000..e25acc73b7 --- /dev/null +++ b/app/views/shared/ref/_debugging.html.haml @@ -0,0 +1,4 @@ +%h3.debugging Debugging +%ul.unstyled + %li= man('git-bisect') + %li= man('git-blame') diff --git a/app/views/shared/ref/_email.html.erb b/app/views/shared/ref/_email.html.erb deleted file mode 100644 index 1976aa7894..0000000000 --- a/app/views/shared/ref/_email.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

    Email

    - diff --git a/app/views/shared/ref/_email.html.haml b/app/views/shared/ref/_email.html.haml new file mode 100644 index 0000000000..8f3db8eeac --- /dev/null +++ b/app/views/shared/ref/_email.html.haml @@ -0,0 +1,7 @@ +%h3.email Email +%ul.unstyled + %li= man('git-am') + %li= man('git-apply') + %li= man('git-format-patch') + %li= man('git-send-email') + %li= man('git-request-pull') diff --git a/app/views/shared/ref/_external.html.erb b/app/views/shared/ref/_external.html.erb deleted file mode 100644 index bd826058f2..0000000000 --- a/app/views/shared/ref/_external.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

    External Systems

    - diff --git a/app/views/shared/ref/_external.html.haml b/app/views/shared/ref/_external.html.haml new file mode 100644 index 0000000000..c5424e5581 --- /dev/null +++ b/app/views/shared/ref/_external.html.haml @@ -0,0 +1,4 @@ +%h3.external External Systems +%ul.unstyled + %li= man('git-svn') + %li= man('git-fast-import') diff --git a/app/views/shared/ref/_inspection.html.erb b/app/views/shared/ref/_inspection.html.erb deleted file mode 100644 index 870ac94bf6..0000000000 --- a/app/views/shared/ref/_inspection.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

    Inspection and Comparison

    - diff --git a/app/views/shared/ref/_inspection.html.haml b/app/views/shared/ref/_inspection.html.haml new file mode 100644 index 0000000000..daab6d4918 --- /dev/null +++ b/app/views/shared/ref/_inspection.html.haml @@ -0,0 +1,7 @@ +%h3.inspection Inspection and Comparison +%ul.unstyled + %li= man('git-show') + %li= man('git-log') + %li= man('git-diff') + %li= man('git-shortlog') + %li= man('git-describe') diff --git a/app/views/shared/ref/_patching.html.erb b/app/views/shared/ref/_patching.html.erb deleted file mode 100644 index a0d1dd48e6..0000000000 --- a/app/views/shared/ref/_patching.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

    Patching

    - diff --git a/app/views/shared/ref/_patching.html.haml b/app/views/shared/ref/_patching.html.haml new file mode 100644 index 0000000000..5a8442bcbf --- /dev/null +++ b/app/views/shared/ref/_patching.html.haml @@ -0,0 +1,6 @@ +%h3.patching Patching +%ul.unstyled + %li= man('git-diff') + %li= man('git-apply') + %li= man('git-cherry-pick') + %li= man('git-rebase') diff --git a/app/views/shared/ref/_plumbing.html.erb b/app/views/shared/ref/_plumbing.html.erb deleted file mode 100644 index 6fcec4704c..0000000000 --- a/app/views/shared/ref/_plumbing.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -

    Plumbing Commands

    - diff --git a/app/views/shared/ref/_plumbing.html.haml b/app/views/shared/ref/_plumbing.html.haml new file mode 100644 index 0000000000..5a270fa45e --- /dev/null +++ b/app/views/shared/ref/_plumbing.html.haml @@ -0,0 +1,17 @@ +%h3.plumbing Plumbing Commands +%ul.unstyled + %li= man('git-cat-file') + %li= man('git-commit-tree') + %li= man('git-count-objects') + %li= man('git-diff-index') + %li= man('git-hash-object') + %li= man('git-merge-base') + %li= man('git-read-tree') + %li= man('git-rev-list') + %li= man('git-rev-parse') + %li= man('git-show-ref') + %li= man('git-symbolic-ref') + %li= man('git-update-index') + %li= man('git-update-ref') + %li= man('git-verify-pack') + %li= man('git-write-tree') diff --git a/app/views/shared/ref/_server.html.erb b/app/views/shared/ref/_server.html.erb deleted file mode 100644 index 4139557dfb..0000000000 --- a/app/views/shared/ref/_server.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

    Server Admin

    - diff --git a/app/views/shared/ref/_server.html.haml b/app/views/shared/ref/_server.html.haml new file mode 100644 index 0000000000..3071a5435d --- /dev/null +++ b/app/views/shared/ref/_server.html.haml @@ -0,0 +1,4 @@ +%h3.server-admin Server Admin +%ul.unstyled + %li= man('git-daemon') + %li= man('git-update-server-info') diff --git a/app/views/shared/ref/_setup.html.erb b/app/views/shared/ref/_setup.html.erb deleted file mode 100644 index ebd722174f..0000000000 --- a/app/views/shared/ref/_setup.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

    Setup and Config

    - diff --git a/app/views/shared/ref/_setup.html.haml b/app/views/shared/ref/_setup.html.haml new file mode 100644 index 0000000000..dbf8b99f8e --- /dev/null +++ b/app/views/shared/ref/_setup.html.haml @@ -0,0 +1,4 @@ +%h3.setup Setup and Config +%ul.unstyled + %li= man('git-config') + %li= man('git-help') diff --git a/app/views/shared/ref/_sharing.html.erb b/app/views/shared/ref/_sharing.html.erb deleted file mode 100644 index d45b116d1c..0000000000 --- a/app/views/shared/ref/_sharing.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

    Sharing and Updating Projects

    - diff --git a/app/views/shared/ref/_sharing.html.haml b/app/views/shared/ref/_sharing.html.haml new file mode 100644 index 0000000000..19149c23d8 --- /dev/null +++ b/app/views/shared/ref/_sharing.html.haml @@ -0,0 +1,7 @@ +%h3.sharing Sharing and Updating Projects +%ul.unstyled + %li= man('git-fetch') + %li= man('git-pull') + %li= man('git-push') + %li= man('git-remote') + %li= man('git-submodule') diff --git a/app/views/shared/ref/_snapshot.html.erb b/app/views/shared/ref/_snapshot.html.erb deleted file mode 100644 index cefd20529a..0000000000 --- a/app/views/shared/ref/_snapshot.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

    Basic Snapshotting

    - diff --git a/app/views/shared/ref/_snapshot.html.haml b/app/views/shared/ref/_snapshot.html.haml new file mode 100644 index 0000000000..641ac1d30f --- /dev/null +++ b/app/views/shared/ref/_snapshot.html.haml @@ -0,0 +1,9 @@ +%h3.snapshotting Basic Snapshotting +%ul.unstyled + %li= man('git-add') + %li= man('git-status') + %li= man('git-diff') + %li= man('git-commit') + %li= man('git-reset') + %li= man('git-rm') + %li= man('git-mv') diff --git a/app/views/site/admin.html.erb b/app/views/site/admin.html.erb deleted file mode 100644 index 9311e30d5e..0000000000 --- a/app/views/site/admin.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
    -

    Admin Page

    - - - <% @downloads.each do |down| %> - - - - - <% end %> -
    <%= down.version.name %><%= down.platform %>
    -
    diff --git a/app/views/site/admin.html.haml b/app/views/site/admin.html.haml new file mode 100644 index 0000000000..66c7a3a1d6 --- /dev/null +++ b/app/views/site/admin.html.haml @@ -0,0 +1,7 @@ +#main + %h1 Admin Page + %table + - @downloads.each do |down| + %tr + %td= down.version.name + %td= down.platform diff --git a/app/views/site/sfc.html.erb b/app/views/site/sfc.html.erb deleted file mode 100644 index bab1be2567..0000000000 --- a/app/views/site/sfc.html.erb +++ /dev/null @@ -1,92 +0,0 @@ -
    -

    Git and The Software Freedom Conservancy

    - -

    Git is a member project of the Software - Freedom Conservancy. The SFC is a not-for-profit organization that - provides financial and administrative assistance to open source projects. - -

    Donation

    - -

    The SFC accepts donations on git's behalf. In the past, project money has - typically gone to defraying travel costs for developers to come to our annual - GitTogether - mini-conference. A portion of the money goes to the SFC to cover their - operating expenses. You can also donate directly to the Conservancy's - general fund. - - - -
    -

    Google Checkout

    -

    To donate to git via Google Checkout: - - -

    - - - - - - - - - - - - - -
    $ - - -
    -
    -
    -

    Paypal

    -

    We can also accept PayPal donations, but note that the fees are - higher for Paypal than other options, so less of your money makes it to - the project. -

    -
    - - - - -
    -
    -
    - - -

    Check or Wire

    -

    We can also accept donations drawn in USD from banks in the USA - (donations from banks outside of the US or not in USD should be handled - by wire). Make checks payable to "Software Freedom Conservancy, Inc." - and place "Directed donation: Git" in the memo field. Checks should be - mailed to: -

    -
    -  Software Freedom Conservancy, Inc.
    -  137 Montague ST STE 380
    -  BROOKLYN, NY 11201 USA
    -  
    -
    - -

    The SFC can accept wire donations, but the instructions vary - depending on the country of origin. Please contact accounting@sfconservancy.org - for instructions. -

    diff --git a/app/views/site/sfc.html.haml b/app/views/site/sfc.html.haml new file mode 100644 index 0000000000..4b37e935cb --- /dev/null +++ b/app/views/site/sfc.html.haml @@ -0,0 +1,83 @@ +#main + %h1#sfc Git and The Software Freedom Conservancy + %p + Git is a member project of the + = succeed "." do + %a{:href => "http://sfconservancy.org/"} + Software + Freedom Conservancy + The SFC is a not-for-profit organization that + provides financial and administrative assistance to open source projects. + %h2.section-start Donation + %p + The SFC accepts donations on git's behalf. In the past, project money has + typically gone to defraying travel costs for developers to come to our annual + %a{:href => "https://git.wiki.kernel.org/index.php/GitTogether"} GitTogether + mini-conference. A portion of the money goes to the SFC to cover their + operating expenses. You can also donate + %a{:href => "http://sfconservancy.org/donate"} directly + to the Conservancy's + general fund. + %table.data-table.software + %tr + %td{:valign => "top"} + %h3.title Google Checkout + %p + To donate to git via Google Checkout: + :javascript + function validateAmount(amount){ + if(amount.value.match( /^[0-9]+(\.([0-9]+))?$/)){ + return true; + }else{ + alert('You must enter a valid donation.'); + amount.focus(); + return false; + } + } + %form#BB_BuyButtonForm{:action => "https://checkout.google.com/cws/v2/Donations/622836985124940/checkoutForm", :method => "post", :name => "BB_BuyButtonForm", :onsubmit => "return validateAmount(this.item_price_1)", :target => "_top"} + %input{:name => "item_name_1", :type => "hidden", :value => "Git Donation via Software Freedom Conservancy"}/ + %input{:name => "item_description_1", :type => "hidden", :value => "Donation to the Git Project via the Software Freedom Conservancy."}/ + %input{:name => "item_quantity_1", :type => "hidden", :value => "1"}/ + %input{:name => "item_currency_1", :type => "hidden", :value => "USD"}/ + %input{:name => "item_is_modifiable_1", :type => "hidden", :value => "true"}/ + %input{:name => "item_min_price_1", :type => "hidden", :value => "5.0"}/ + %input{:name => "item_max_price_1", :type => "hidden", :value => "25000.0"}/ + %input{:name => "_charset_", :type => "hidden", :value => "utf-8"}/ + %table{:cellpadding => "5", :cellspacing => "0", :width => "1%"} + %tr + %td{:align => "right", :nowrap => "nowrap", :width => "1%"} + $ + %input#item_price_1{:name => "item_price_1", :onfocus => "this.style.color='black'; this.value='';", :size => "11", :style => "color:grey;", :type => "text", :value => "Enter Amount"}/ + %td{:align => "left", :width => "1%"} + %input{:alt => "Donate", :src => "https://checkout.google.com/buttons/donateNow.gif?merchant_id=622836985124940&w=115&h=50&style=white&variant=text&loc=en_US", :type => "image"}/ + %td{:valign => "top"} + %h3.title Paypal + %p + We can also accept PayPal donations, but note that the fees are + higher for Paypal than other options, so less of your money makes it to + the project. + .center + %form{:action => "https://www.paypal.com/cgi-bin/webscr", :method => "post"} + %input{:name => "cmd", :type => "hidden", :value => "_s-xclick"}/ + %input{:name => "hosted_button_id", :type => "hidden", :value => "GXTE9AECX4LAL"}/ + %input{:alt => "PayPal - The safer, easier way to pay online!", :border => "0", :name => "submit", :src => "https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif", :type => "image"}/ + %img{:alt => "", :border => "0", :height => "1", :src => "https://www.paypal.com/en_US/i/scr/pixel.gif", :width => "1"}/ + %h3.title Check or Wire + %p + We can also accept donations drawn in USD from banks in the USA + (donations from banks outside of the US or not in USD should be handled + by wire). Make checks payable to "Software Freedom Conservancy, Inc." + and place "Directed donation: Git" in the memo field. Checks should be + mailed to: + .center + %pre + :preserve + + Software Freedom Conservancy, Inc. + 137 Montague ST STE 380 + BROOKLYN, NY 11201 USA + %p + The SFC can accept wire donations, but the instructions vary + depending on the country of origin. Please contact + %a{:href => "mailto:accounting@sfconservancy.org"} accounting@sfconservancy.org + for instructions. diff --git a/app/views/site/svn.html.erb b/app/views/site/svn.html.erb deleted file mode 100644 index ed993a6adc..0000000000 --- a/app/views/site/svn.html.erb +++ /dev/null @@ -1,535 +0,0 @@ -<% @section = 'documentation' %> -<% @subsection = 'reference' %> - - - -
    -

    Git - SVN Crash Course

    - -

    Welcome to the Git version control system! Here we will briefly - introduce you to Git usage based on your current Subversion knowledge. You will - need the latest Git installed; - There is also a potentially useful - - tutorial in the Git documentation.

    - -
    - -
    - -
    - -
    -

    If you are just after tracking someone else's project, - this get you started quickly:

    -

    - - - - -
    git clone url
    git pull
    svn checkout url
    svn update
    -

    - - -
    - -

    How to Read Me

    - -

    In those small tables, at the left we always list the Git commands - for the task, while at the right the corresponding Subversion commands you would use - for the job are listed. If you are in hurry, just skimming over them should - give you a good idea about the Git usage basics.

    - -

    Before running any command the first time, it's recommended that you - at least quickly skim through its manual page. Many of the commands have - very useful and interesting features (that we won't list here) and sometimes - there are some extra notes you might want to know. There's a quick usage - help available for the Git commands if you pass them the -h - switch.

    - - -

    Things You Should Know

    - -

    There are couple important concepts it is good to know when - starting with Git. If you are in hurry though, you can skip this - section and only get back to it when you get seriously confused; - it should be possible to pick up with just using your intuition.

    - - - -

    Commiting

    - -

    For the first introduction, let's make your project tracked by Git - and see how we get around to do daily development in it. Let's - cd to the directory with your project and initialize - a brand new Git repository with it:

    - - - - -
    git init
    git add .
    git commit
    svnadmin create repo
    svn import file://repo
    - -

    git init will initialize the repository, - git add . will add all the files under the current directory - and git commit will create the - initial import, given that repositories are coupled with working copies.

    - -

    Now your tree is officially tracked by Git. You can explore the - .git subdirectory a bit if you want, or don't if you - don't care. Do some random changes to your tree now - poke into few - files or such. Let's check what we've done:

    - - - - -
    git diffsvn diff | less
    - -

    That's it. This is one of the more powerful commands. To get a diff with an - specific revision and path do:

    - - - - -
    git diff rev pathsvn diff -rrev path
    - -

    Git embeds special information in - the diffs about adds, removals and mode changes:

    - - - - -
    git applypatch -p0
    - -

    That will apply the patch while telling Git about and performing - those "meta-changes".

    - -

    There is a more concise representation of changes available:

    - - - - - -
    git statussvn status
    - -

    This will show the concise changes summary as well as list any files - that you haven't either ignored or told Git about. In addition, - it will also show at the top which branch you are in.

    - -

    While we are at the status command, over time plenty of the - "Untracked files" will get in there, denoting files not tracked by Git. - Wait a moment if you want to add them, run git clean - if you want to get rid of all of them, or add them to the .gitignore - - file if you want to keep them around untracked (works the same as the svn:ignore - property in SVN).

    - -

    To restore a file from the last revision:

    - - - - -
    git checkout pathsvn revert path
    - -

    You can restore everything or just specified files.

    - -

    So, just like in SVN, you need to tell Git when you add, move or - remove any files:

    - - - -
    git add file -
    git rm file - -
    git mv file
    svn add file
    svn rm file
    svn mv file
    - -

    You can also recursively add/remove whole directories and so on; - Git's cool!

    - -

    So, it's about time we commit our changes. Big surprise - about the command:

    - - - - -
    git commit -asvn commit
    - -

    to commit all the changes or, as with Subversion, - you can limit the commit only to specified files - and so on. A few words on the commit message: it is customary - to have a short commit summary as the first line of the message, - because various tools listing commits frequently show only the - first line of the message. You can specify the commit message - using the -m parameter as you are used, but - you can pass several -m arguments and they will create - separate paragraphs in the commit message:

    - -

    If you don't pass any -m parameter or pass - the -e parameter, your favorite $EDITOR - will get run and you can compose your commit message there, - just as with Subversion. In addition, the list of files to be committed - is shown.

    - -

    And as a bonus, if you pass it the -v parameter - it will show the whole patch being committed in the editor - so that you can do a quick last-time review.

    - -

    By the way, if you screwed up committing, there's not much you - can do with Subversion, except using some enigmatic svnadmin - subcommands. Git does it better - you can amend your latest commit - (re-edit the metadata as well as update the tree) using - git commit --amend, or toss your latest - commit away completely using git reset HEAD^, - this will not change the working tree.

    - -

    Browsing

    - -

    Now that we have committed some stuff, you might want to review - your history:

    - - - - -
    git log
    git blame file
    svn log | less
    svn blame file
    - -

    The log command works quite similar in SVN and Git; again, - git log is quite powerful, please look through - its options to see some of the stuff it can do.

    - -

    The blame command is more powerful as it can detect the movement of lines, - even with file copies and renames. But there is a - big chance that you probably want to do something different! Usually, - when using annotate you are looking for the origin of some piece of - code, and the so-called pickaxe of Git is much more comfortable - tool for that job (git log -Sstring shows the - commits which add or remove any file data matching string).

    - -

    You can see the contents of a file, the listing of a directory or - a commit with:

    - - - - - - - -
    git show rev:path/to/file -
    git show rev:path/to/directory -
    git show rev
    svn cat url -
    svn list url -
    svn log -rrev url -
    svn diff -crev url
    - -

    Tagging and branching

    - -

    Subversion marks certain checkpoints in history through copies, the copy is - usually placed in a directory named tags. Git tags are much more powerful. - The Git tag can have an arbitrary description attached (the first - line is special as in the commit case), some people actually store - the whole release announcements in the tag descriptions. The identity - of the person who tagged is stored (again following the same rules - as identity of the committer). You can tag other objects than commits (but - that is conceptually rather low-level operation). - And the tag can be cryptographically PGP signed to verify the identity - (by Git's nature of working, that signature also confirms the validity - of the associated revision, its history and tree). So, let's do it:

    - - - - - -
    git tag -a namesvn copy http://example.com/svn/trunk - http://example.com/svn/tags/name
    - -

    To list tags and to show the tag message:

    - - - - -
    git tag -l
    git show tag
    svn list http://example.com/svn/tags/ - -
    svn log --limit 1 http://example.com/svn/tags/tag
    - -

    Like Subversion, Git can do branches (surprise surprise!). In Subversion, - you basically copy your project to a subdirectory. In Git, you tell it, - well, to create a branch.

    - - - - -
    git branch branch - -
    git checkout branch
    svn copy http://example.com/svn/trunk - http://example.com/svn/branches/branch -
    svn switch - http://example.com/svn/branches/branch
    - -

    The first command creates a branch, the second command switches - your tree to a certain branch. You can pass an extra argument to - git branch to base your new branch on a different - revision than the latest one.

    - -

    You can list your branches conveniently using the aforementioned - git-branch command without arguments the listing of branches. - The current one is denoted by an "*".

    - - - - -
    git branchsvn list http://example.com/svn/branches/
    - -

    To move your tree to some older revision, use:

    - - - - -
    git checkout rev -
    git checkout prevbranch
    svn update -r rev
    svn update
    - -

    or you could create a temporary branch. In Git you can make commits on - top of the older revision and use it as another branch.

    - -

    Merging

    - -

    Git supports merging between branches much better than Subversion - history - of both branches is preserved over the merges and repeated merges - of the same branches are supported out-of-the-box. Make sure you are on - one of the to-be-merged branches and merge the other one now:

    - - - - - -
    git merge branch - svn merge -r 20:HEAD - http://example.com/svn/branches/branch -
    (assuming the branch was created in revision 20 and - you are inside a working copy of trunk) -
    - -

    If changes were made on only one of the branches since the last merge, - they are simply replayed on your other branch (so-called fast-forward merge). - If changes were made on both branches, they are merged intelligently - (so-called three-way merge): if any changes conflicted, git merge - will report them and let you resolve them, updating the rest of the tree - already to the result state; you can git commit when you resolve - the conflicts. If no changes conflicted, a commit is made automatically with - a convenient log message (or you can do - - git merge --no-commit branch to review the merge - result and then do the commit yourself).

    - -

    Aside from merging, sometimes you want to just pick one commit from - a different branch. To apply the changes in revision rev and commit - them to the current branch use:

    - - - - - -
    git cherry-pick revsvn merge -c rev url
    - -

    Going Remote

    - -

    So far, we have neglected that Git is a distributed version - control system. It is time for us to set the record straight - let's grab - some stuff from remote sites.

    - -

    If you are working on someone else's project, you usually want to clone - its repository instead of starting your own. We've already mentioned that at the top - of this document:

    - - - - -
    git clone urlsvn checkout url
    - -

    Now you have the default branch (normally master), - but in addition you got all the remote branches and tags. - In clone's default setup, the default local branch tracks - the origin remote, which represents the default branch in the - remote repository.

    - -

    Remote branch, you ask? Well, so far we have worked - only with local branches. Remote branches are a mirror image of branches - in remote repositories and you don't ever switch to them directly or write - to them. Let me repeat - you never mess with remote branches. If you want - to switch to a remote branch, you need to create a corresponding local - branch which will "track" the remote branch:

    - - - - -
    - git checkout -b branch origin/branchsvn switch url
    - -

    You can add more remote branches to a cloned repository, as well as just - an initialized one, using git remote add remote url. - The command git remote lists all the remotes - repositories and git remote show remote shows - the branches in a remote repository.

    - -

    Now, how do you get any new changes from a remote repository? - You fetch them: git fetch. - At this point they are in your repository and you can examine them using - git log origin (git log HEAD..origin - to see just the changes you don't have in your branch), diff them, and obviously, merge them - just do - git merge origin. Note that if you don't specify a branch - to fetch, it will conveniently default to the tracking remote.

    - -

    Since you frequently just fetch + merge the tracking remote branch, - there is a command to automate that:

    - - - - -
    git pullsvn update
    - -

    Sharing the Work

    - -

    Your local repository can be used by others to pull changes, but - normally you would have a private repository and a public repository. - The public repository is where everybody pulls and you... do the - opposite? Push your changes? Yes! - We do git push remote which will push - all the local branches with a corresponding remote branch - note that this works - generally only over SSH (or HTTP but with special webserver setup). - It is highly recommended to setup a SSH key and an SSH agent mechanism - so that you don't have to type in a password all the time.

    - -

    One important thing is that you should push only to remote branches - that are not currently checked out on the other side (for the same - reasons you never switch to a remote branch locally)! Otherwise the - working copy at the remote branch will get out of date and confusion - will ensue. The best way to avoid that is to push only to remote - repositories with no working copy at all - so called bare - repositories which are commonly used for public access or developers' - meeting point - just for exchange of history where a checked out copy - would be a waste of space anyway. You can create such a repository. - See Setting up a public repository for details.

    - -

    Git can work with the same workflow as Subversion, with a group of developers - using a single repository for exchange of their work. The only change - is that their changes aren't submitted automatically but they have - to push (however, you can setup a post-commit hook that will push for you - every time you commit; that loses the flexibility to fix up a screwed - commit, though). The developers must have either an entry in htaccess - (for HTTP DAV) or a UNIX account (for SSH). You can restrict their - shell account only to Git pushing/fetching by using the - git-shell login shell.

    - -

    You can also exchange patches by mail. Git has very good support - for patches incoming by mail. You can apply them by feeding mailboxes - with patch mails to git am. If you - want to send patches use git format-patch and - possibly git send-email. - -

    If you have any questions or problems which are not obvious from - the documentation, please contact us at the Git mailing list - at git@vger.kernel.org. - We hope you enjoy using Git!

    -
    diff --git a/app/views/site/svn.html.haml b/app/views/site/svn.html.haml new file mode 100644 index 0000000000..7ae56291ca --- /dev/null +++ b/app/views/site/svn.html.haml @@ -0,0 +1,743 @@ +- @section = 'documentation' +- @subsection = 'reference' +:css + table.ccmd td { border: 1px; padding-left: 2em; padding-right: 2em; } + table.ccmd { width: 99%; border: 1px solid #000; margin-bottom: 15px; } + table.ccmd, code.g { font-family: monospace; } + table.ccmd td.g { width: 33%; } + table.ccmd td.g, code.g { font-weight: bold; } + table.ccmd td.g { background: #e9e8e1; color: #444; } +#main.book + %h1 Git - SVN Crash Course + %p + Welcome to the Git version control system! Here we will briefly + introduce you to Git usage based on your current Subversion knowledge. You will + need the latest + %a{:href => "http://git.or.cz/"} Git + installed; + There is also a potentially useful + %a{:href => "http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html"} + tutorial + in the Git documentation. + .doc-toc + %ul + %li + %a{:href => "#read"} How to Read Me + %li + %a{:href => "#know"} Things To Know + %li + %a{:href => "#commit"} Commiting + %li + %a{:href => "#browse"} Browsing + %li + %a{:href => "#branch"} Tagging and Branching + %li + %a{:href => "#merge"} Merging + %li + %a{:href => "#remote"} Going Remote + %li + %a{:href => "#share"} Sharing the Work + %div{:style => "text-align:center;"} + %table.relnotes{:style => "margin-left: auto; margin-right: auto; border: 1px"} + %tr + %td{:style => "text-align:center;"} + %p{:style => "margin: 0em 0.4em"} + If you are just after tracking someone else's project, + this get you started quickly: + %p + %table.ccmd{:style => "margin:0em; margin-left: auto; margin-right: auto;"} + %tr + %td.g + git clone + %em url + = succeed "git" do + %br/ + pull + %td + svn checkout  + %em url + = succeed "svn" do + %br/ + update + %hr/ + %h2#read How to Read Me + %p + In those small tables, at the left we always list the Git commands + for the task, while at the right the corresponding Subversion commands you would use + for the job are listed. If you are in hurry, just skimming over them should + give you a good idea about the Git usage basics. + %p + Before running any command the first time, it's recommended that you + at least quickly skim through its manual page. Many of the commands have + very useful and interesting features (that we won't list here) and sometimes + there are some extra notes you might want to know. There's a quick usage + help available for the Git commands if you pass them the + %code -h + switch. + %h2#know Things You Should Know + %p + There are couple important concepts it is good to know when + starting with Git. If you are in hurry though, you can skip this + section and only get back to it when you get seriously confused; + it should be possible to pick up with just using your intuition. + %ul + %li + %b Repositories. + With Subversion, for each project there is a single repository at some + detached central place where all the history is and which you checkout + and commit into. Git works differently, each copy of the project tree + (we call that the + = succeed ")" do + %em working copy + carries its own repository + around (in the + %code .git + subdirectory in the project tree root). + So you can have local and remote branches. + You can also have a so-called + %em bare repository + which is not + attached to a working copy; that is useful especially when you want + to publish your repository. We will get to that. + %li + %b URL. + In Subversion the + %em URL + identifies the location of the repository + and the path inside the repository, so you organize the layout of the + repository and its meaning. Normally you would have + = succeed "," do + %code trunk/ + %code branches/ + and + %code tags/ + directories. In Git + the + %em URL + is just the location of the repository, and it always + contains branches and tags. One of the branches is the default (normally named + master). + %li + %b Revisions. + Subversion identifies revisions with ids of decimal numbers growing + monotonically which are typically small (although they can get quickly + to hundreds of thousands for large projects). That is impractical in distributed systems like Git. Git + identifies revisions with SHA1 ids, which are long 160-bit numbers + written in hexadecimal. It may look scary at first, but in practice it is + not a big hurdle - you can refer to the latest revision by + = succeed "," do + %code HEAD + its parent as + %code HEAD^ + and its parent as + %code HEAD^^ = HEAD~2 + (you can go on adding carrets), + cut'n'paste helps a lot and you can write only the few leading digits + of a revision - as long as it is unique, Git will guess the rest. + (You can do even more advanced stuff with revision specifiers, see the + %a{:href => "http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html"} git-rev-parse manpage + for details.) + %li + %b Commits. + Each commit has an + %em author + and a + %em committer + field, + which record who and when + %em created + the change and who + %em committed + it + (Git is designed to work well with patches coming by mail - in that case, + the author and the committer will be different). Git will try to guess + your realname and email, but especially with email it is likely to get it wrong. + You can check it using + %code.g git config -l + and set them with: + %pre + :preserve + + git config --global user.name "Your Name Comes Here" + git config --global user.email you@yourdomain.example.com + %li + %b Commands. + The Git commands are in the form + = succeed "." do + %code git command + You can interchangeably use the + %code git-command + form as well. + %li + %b Colors. + Git can produce colorful output with some commands; since + some people hate colors way more than the rest likes them, by default + the colors are turned off. If you would like to have colors in your + output: + %pre + :preserve + + git config --global color.diff auto + git config --global color.status auto + git config --global color.branch auto + %li + %b Visualize. + You may find it convenient to watch your repository using + the + %code.g gitk + repository as you go. + %h2#commit Commiting + %p + For the first introduction, let's make your project tracked by Git + and see how we get around to do daily development in it. Let's + %code cd + to the directory with your project and initialize + a brand new Git repository with it: + %table.ccmd + %tr + %td.g + git init + %br>/ + git add . + %br>/ + git commit + %td + svnadmin create + %em repo + = succeed "svn" do + %br/ + import + %em file://repo + %p + %code git init + will initialize the repository, + %code git add . + will add all the files under the current directory + and + %code git commit + will create the + initial import, given that repositories are coupled with working copies. + %p + Now your tree is officially tracked by Git. You can explore the + %code.g .git + subdirectory a bit if you want, or don't if you + don't care. Do some random changes to your tree now - poke into few + files or such. Let's check what we've done: + %table.ccmd + %tr + %td.g git diff + %td svn diff | less + %p + That's it. This is one of the more powerful commands. To get a diff with an + specific revision and path do: + %table.ccmd + %tr + %td.g + git diff + %em rev + %em path + %td + svn diff -r + %em rev + %em path + %p + Git embeds special information in + the diffs about adds, removals and mode changes: + %table.ccmd + %tr + %td.g git apply + %td patch -p0 + %p + That will apply the patch while telling Git about and performing + those "meta-changes". + %p There is a more concise representation of changes available: + %table.ccmd + %tr + %td.g git status + %td svn status + %p + This will show the concise changes summary as well as list any files + that you haven't either ignored or told Git about. In addition, + it will also show at the top which branch you are in. + %p + While we are at the status command, over time plenty of the + "Untracked files" will get in there, denoting files not tracked by Git. + Wait a moment if you want to add them, run + %code.g git clean + if you want to get rid of all of them, or add them to the + %code.g .gitignore + file if you want to keep them around untracked (works the same as the + %code svn:ignore + property in SVN). + %p To restore a file from the last revision: + %table.ccmd + %tr + %td.g + git checkout + %em path + %td + svn revert + %em path + %p You can restore everything or just specified files. + %p + So, just like in SVN, you need to tell Git when you add, move or + remove any files: + %table.ccmd + %tr + %td.g + git add + %em file + = succeed "git" do + %br/ + rm + %em file + = succeed "git" do + %br/ + mv + %em file + %td + svn add + %em file + = succeed "svn" do + %br/ + rm + %em file + = succeed "svn" do + %br/ + mv + %em file + %p + You can also recursively add/remove whole directories and so on; + Git's cool! + %p + So, it's about time we commit our changes. Big surprise + about the command: + %table.ccmd + %tr + %td.g git commit -a + %td svn commit + %p + to commit all the changes or, as with Subversion, + you can limit the commit only to specified files + and so on. A few words on the commit message: it is + %em customary + to have a short commit summary as the first line of the message, + because various tools listing commits frequently show only the + first line of the message. You can specify the commit message + using the + %code -m + parameter as you are used, but + you can pass several + %code -m + arguments and they will create + separate paragraphs in the commit message: + %p + If you don't pass any + %code -m + parameter or pass + the + %code -e + parameter, your favorite + %code $EDITOR + will get run and you can compose your commit message there, + just as with Subversion. In addition, the list of files to be committed + is shown. + %p + And as a bonus, if you pass it the + %code -v + parameter + it will show the whole patch being committed in the editor + so that you can do a quick last-time review. + %p + By the way, if you screwed up committing, there's not much you + can do with Subversion, except using some enigmatic + %code svnadmin + subcommands. Git does it better - you can amend your latest commit + (re-edit the metadata as well as update the tree) using + = succeed "," do + %code.g git commit --amend + or toss your latest + commit away completely using + = succeed "," do + %code.g git reset HEAD^ + this will not change the working tree. + %h2#browse Browsing + %p + Now that we have committed some stuff, you might want to review + your history: + %table.ccmd + %tr + %td.g + git log + %br>/ + git blame + %em file + %td + svn log | less + %br>/ + svn blame + %em file + %p + The log command works quite similar in SVN and Git; again, + %code git log + is quite powerful, please look through + its options to see some of the stuff it can do. + %p + The blame command is more powerful as it can detect the movement of lines, + even with file copies and renames. But there is a + big chance that you probably want to do something different! Usually, + when using annotate you are looking for the origin of some piece of + code, and the so-called + %em pickaxe + of Git is much more comfortable + tool for that job ( + %code + git log -S + %em string + shows the + commits which add or remove any file data matching + = succeed ")." do + %em string + %p + You can see the contents of a file, the listing of a directory or + a commit with: + %table.ccmd + %tr + %td.g + git show + = succeed ":" do + %em rev + %em path/to/file + = succeed "git&nbsp;show&nbsp;" do + %br/ + = succeed ":" do + %em rev + %em path/to/directory + = succeed "git" do + %br/ + show + %em rev + %td + svn cat + %em url + = succeed "svn" do + %br/ + list + %em url + = succeed "svn" do + %br/ + log -r + %em rev + %em url + = succeed "svn" do + %br/ + diff -c + %em rev + %em url + %h2#branch Tagging and branching + %p + Subversion marks certain checkpoints in history through copies, the copy is + usually placed in a directory named tags. Git tags are much more powerful. + The Git tag can have an arbitrary description attached (the first + line is special as in the commit case), some people actually store + the whole release announcements in the tag descriptions. The identity + of the person who tagged is stored (again following the same rules + as identity of the committer). You can tag other objects than commits (but + that is conceptually rather low-level operation). + And the tag can be cryptographically PGP signed to verify the identity + (by Git's nature of working, that signature also confirms the validity + of the associated revision, its history and tree). So, let's do it: + %table.ccmd + %tr + %td.g + git tag -a + %em name + %td + svn copy http://example.com/svn/trunk + http://example.com/svn/tags/ + %em name + %p To list tags and to show the tag message: + %table.ccmd + %tr + %td.g + git tag -l + %br>/ + git show + %em tag + %td + svn list http://example.com/svn/ + %em tags/ + = succeed "svn&nbsp;log" do + %br/ + \--limit 1 http://example.com/svn/tags/ + %em tag + %p + Like Subversion, Git can do branches (surprise surprise!). In Subversion, + you basically copy your project to a subdirectory. In Git, you tell it, + well, to create a branch. + %table.ccmd + %tr + %td.g + git branch + %em branch + = succeed "git&nbsp;checkout&nbsp;" do + %br/ + %em branch + %td + svn copy http://example.com/svn/trunk + http://example.com/svn/branches/ + %em branch + = succeed "svn" do + %br/ + switch + http://example.com/svn/branches/ + %em branch + %p + The first command creates a branch, the second command switches + your tree to a certain branch. You can pass an extra argument to + %code git branch + to base your new branch on a different + revision than the latest one. + %p + You can list your branches conveniently using the aforementioned + %code git-branch + command without arguments the listing of branches. + The current one is denoted by an "*". + %table.ccmd + %tr + %td.g git branch + %td svn list http://example.com/svn/branches/ + %p To move your tree to some older revision, use: + %table.ccmd + %tr + %td.g + git checkout + %em rev + = succeed "git" do + %br/ + checkout + %em prevbranch + %td + svn update -r + %em rev + = succeed "svn" do + %br/ + update + %p + or you could create a temporary branch. In Git you can make commits on + top of the older revision and use it as another branch. + %h2#merge Merging + %p + Git supports merging between branches much better than Subversion - history + of both branches is preserved over the merges and repeated merges + of the same branches are supported out-of-the-box. Make sure you are on + one of the to-be-merged branches and merge the other one now: + %table.ccmd + %tr + %td.g + git merge + %em branch + %td + svn merge -r 20:HEAD + http://example.com/svn/branches/ + %em branch + %br/ + %em + (assuming the branch was created in revision 20 and + you are inside a working copy of trunk) + %p + If changes were made on only one of the branches since the last merge, + they are simply replayed on your other branch (so-called + = succeed ")." do + %em fast-forward merge + If changes were made on both branches, they are merged intelligently + (so-called + = succeed "):" do + %em three-way merge + if any changes conflicted, + %code git merge + will report them and let you resolve them, updating the rest of the tree + already to the result state; you can + %code git commit + when you resolve + the conflicts. If no changes conflicted, a commit is made automatically with + a convenient log message (or you can do + %code.g + git merge --no-commit + %em branch + to review the merge + result and then do the commit yourself). + %p + Aside from merging, sometimes you want to just pick one commit from + a different branch. To apply the changes in revision + %em rev + and commit + them to the current branch use: + %table.ccmd + %tr + %td.g + git cherry-pick + %em rev + %td + svn merge -c + %em rev + %em url + %h2#remote Going Remote + %p + So far, we have neglected that Git is a + %em distributed + version + control system. It is time for us to set the record straight - let's grab + some stuff from remote sites. + %p + If you are working on someone else's project, you usually want to + %em clone + its repository instead of starting your own. We've already mentioned that at the top + of this document: + %table.ccmd + %tr + %td.g + git clone + %em url + %td + svn checkout  + %em url + %p + Now you have the default branch (normally + = succeed ")," do + %code master + but in addition you got all the remote branches and tags. + In clone's default setup, the default local branch tracks + the + %em origin + remote, which represents the default branch in the + remote repository. + %p + %em> Remote branch + , you ask? Well, so far we have worked + only with local branches. Remote branches are a mirror image of branches + in remote repositories and you don't ever switch to them directly or write + to them. Let me repeat - you never mess with remote branches. If you want + to switch to a remote branch, you need to create a corresponding local + branch which will "track" the remote branch: + %table.ccmd + %tr + %td.g + git checkout -b + %em branch + origin/ + %em branch + %td + svn switch  + %em url + %p + You can add more remote branches to a cloned repository, as well as just + an initialized one, using + = succeed "." do + %code.g + git remote add + %em remote + %em url + The command + %code.g git remote + lists all the remotes + repositories and + %code.g + git remote show + %em remote + shows + the branches in a remote repository. + %p + Now, how do you get any new changes from a remote repository? + You fetch them: + = succeed "." do + %code.g git fetch + At this point they are in your repository and you can examine them using + %code + git log + %em origin + ( + %code + git log HEAD.. + %em origin + to see just the changes you don't have in your branch), diff them, and obviously, merge them - just do + = succeed "." do + %code + git merge + %em origin + Note that if you don't specify a branch + to fetch, it will conveniently default to the tracking remote. + %p + Since you frequently just fetch + merge the tracking remote branch, + there is a command to automate that: + %table.ccmd + %tr + %td.g git pull + %td svn update + %h2#share Sharing the Work + %p + Your local repository can be used by others to + %em pull + changes, but + normally you would have a private repository and a public repository. + The public repository is where everybody pulls and you... do the + opposite? + %em Push + your changes? Yes! + We do + %code.g + git push + %em remote + which will push + all the local branches with a corresponding remote branch - note that this works + generally only over SSH (or HTTP but with special webserver setup). + It is highly recommended to setup a SSH key and an SSH agent mechanism + so that you don't have to type in a password all the time. + %p + One important thing is that you should push only to remote branches + that are not currently checked out on the other side (for the same + reasons you never switch to a remote branch locally)! Otherwise the + working copy at the remote branch will get out of date and confusion + will ensue. The best way to avoid that is to push only to remote + repositories with no working copy at all - so called + %em bare + repositories which are commonly used for public access or developers' + meeting point - just for exchange of history where a checked out copy + would be a waste of space anyway. You can create such a repository. + See + %a{:href => "/docs/user-manual.html#setting-up-a-public-repository"} Setting up a public repository + for details. + %p + Git can work with the same workflow as Subversion, with a group of developers + using a single repository for exchange of their work. The only change + is that their changes aren't submitted automatically but they have + to push (however, you can setup a post-commit hook that will push for you + every time you commit; that loses the flexibility to fix up a screwed + commit, though). The developers must have either an entry in htaccess + (for HTTP DAV) or a UNIX account (for SSH). You can restrict their + shell account only to Git pushing/fetching by using the + %code.g git-shell + login shell. + %p + You can also exchange patches by mail. Git has very good support + for patches incoming by mail. You can apply them by feeding mailboxes + with patch mails to + = succeed "." do + %code.g git am + If you + want to + %em send + patches use + %code.g git format-patch + and + possibly + = succeed "." do + %code.g git send-email + %p + If you have any questions or problems which are not obvious from + the documentation, please contact us at the + %strong Git mailing list + at + = succeed "." do + %a{:href => "mailto:git@vger.kernel.org"} git@vger.kernel.org + We hope you enjoy using Git!