test: remove httpd tests that ask for user
[git] / README.md
1 # git-fc
2
3 git-fc is a friendly fork of Git, which means it's a fork that won't deviate
4 from the mainline; it is more like a branch in Git terms. This branch will move
5 forward close to Git's mainline, and it could be merged at any point in time,
6 if the maintainer wished to do so.
7
8 git-fc doesn't include experimental code, or half-assed features, so you can
9 expect the same level of stability as Git's mainline. Also, it doesn't remove
10 any feature, or do any backwards incompatible changes, so you can replace git
11 with git-fc and you wouldn't notice the difference. The difference comes in the
12 extra features, that is all.
13
14 ## Maintenance
15
16 Each release of Git is merged directly into git-fc, so if there's a new feature
17 in Git, git-fc will get it as well.
18
19 Every extra feature is maintained individually in a separate branch, so if you
20 are interested in a specific feature and don't trust the rest of git-fc, you
21 can use that branch instead. For example the publish tracking branch feature is
22 maintained in the 'fc/publish' branch which sits on top of git.git's v1.9.2.
23 You can grab the specific branch and do whatever you want with it.
24
25 ## Extra features
26
27 ### Streamlined remote helpers
28
29 `git-remote-hg` and `git-remote-bzr` are remote helpers that allow two-way
30 communication between Git and Mercurial/Bazaar. They have been proven to be
31 very reliable and solid, and used by many people. In order to use them in Git
32 mainline you might need a bit of tinkering.
33
34 With git-fc they are installed by default, and in the right way. Plus there are
35 fixes in the remote helper infrastructure so they always work better than in
36 Git mainline.
37
38 ### New 'git update' tool
39
40 Everybody has agreed the `git pull` command is broken for most use-cases, which
41 is why most seasoned Git users avoid it, and it is recommended for new users to
42 avoid it.
43
44 A new tool is necessary for the most common use case, which is fetch all the
45 updates and update the current branch if possible.
46
47 The new `git update` will fast-forward to the latest commit in the remote
48 branch if there's no divergence (you haven't made extra commits). But if you
49 have made extra commits you will be told to either merge or rebase, or run `git
50 update --merge` or `git update --rebase`.
51
52 This ensures that new users won't be making merges by mistake.
53
54 Additionally, when doing a merge the order of the parents will be reversed, so
55 it would appear as if you are merging your local branch to the remote one, and
56 not the other way around like `git pull` does. Everybody has agreed this is a
57 problem with `git pull`.
58
59 ### Publish tracking branch
60
61 Git mainline doesn't have the greatest support for triangular workflows, a good
62 solution for that is to introduce a second "upstream" tracking branch which is
63 for the reverse; the branch you normally push to.
64
65 Say you clone a repository (libgit2) in GitHub, then create a branch
66 (feature-a) and push it to your personal repository, you would want to track
67 two branches (origin/master), and (mine/feature-a), but Git mainline only
68 provides support for a single upstream tracking branch.
69
70 If you setup your upstream tracking branch to 'origin/master', then you can
71 just do `git rebase` without arguments and git will pick the right branch
72 (origin/master) to rebase to. However, `git push` by default will also try to
73 push to 'origin/master', which is not what you want. Plus `git branch -v` will
74 show how ahead/behind your branch is compared to origin/master, not
75 mine/feature-a.
76
77 If you set up your upstream to 'mine/feature-a', then `git push` will work, but
78 `git rebase` won't.
79
80 With this option, `git rebase` uses the upstream branch, and `git push` uses
81 the publish branch.
82
83 Setting the upstream tracking branch is easy:
84
85     git push --set-publish mine feature-a
86
87 Or:
88
89     git branch --set-publish mine/feature-a
90
91 And `git branch -v` will show it as well:
92
93 ```
94   fc/branch/fast      177dcad [master, gh/fc/branch/fast] branch: ...
95   fc/stage            abb6ad5 [master, gh/fc/stage] completion: ..
96   fc/transport/improv eb4d3c7 [master, gh/fc/transport/improv] ...
97 ```
98
99 ### Official staging area
100
101 Everybody already uses the term "staging area" already, and Git developers also
102 agreed it the best term to what is officially referred to as "the index". So
103 git-fc has new options for all commands that modify the staging area (e.g. `git
104 grep --staged`, `git rm --staged`), and also adds a new `git stage` command
105 that makes it easier to work with the staging area.
106
107 ```
108 'git stage' [options] [--] [<paths>...]
109 'git stage add' [options] [--] [<paths>...]
110 'git stage reset' [-q|--patch] [--] [<paths>...]
111 'git stage diff' [options] [<commit>] [--] [<paths>...]
112 'git stage rm' [options] [--] [<paths>...]
113 'git stage apply' [options] [--] [<paths>...]
114 'git stage edit'
115 ```
116
117 Without any command, `git stage` adds files to the stage, same as `git add`, same as in Git mainline.
118
119 ### Nice 'branch -v'
120
121 Currently `git branch -v` will show you the tracking status (ahead/behind), but
122 wouldn't show you which from which branch, and it takes considerable amount of
123 time (compared to most Git commands).
124
125 This is fixed so the branch is showed instead, which is more useful and faster.
126 If you want the tracking status, you can use `git branch -vv` which shows
127 everything, as with Git mainline.
128
129 ```
130   fc/branch/fast      177dcad [master] branch: ...
131   fc/stage            abb6ad5 [master] completion: ...
132   fc/transport/improv eb4d3c7 [master] transport-helper: ...
133 ```
134
135 ### Default aliases
136
137 Many (if not all) version control system tools have shortcuts for their most
138 common operations; `hg ci`, `svn co`, `cvs st`, but not Git... git-fc does:
139
140     co = checkout
141     ci = commit
142     rb = rebase
143     st = status
144     br = branch
145     pi = cherry-pick
146     mt = mergetool
147
148 If you have already these aliases, or mapped to something else, your aliases
149 would take precedence over the default ones, so you won't have any problems.
150
151 ### New core.mode configuration
152
153 The behavior of Git v2.0 is already being defined, but there's no way to test
154 it, if you want to test it, along with all future behaviors, you can enable it
155 on git-fc by setting the configuration `core.mode = next`.
156
157 In addition to the "next" (v2.0) mode, there's the "progress" mode. This mode
158 enables "next" plus other configurations that are saner.
159
160 It is recommended that you setup this mode for git-fc:
161
162     git config --global core.mode progress
163
164 ### New fetch.default configuration
165
166 When you have configured the upstream tracking branch for all your branches,
167 you will probably have tracking branches that point to a local branch, for
168 example 'feature-a' pointing to 'master', in which case you would get something
169 like:
170
171 ````
172 % git fetch
173 From .
174  * branch            master     -> FETCH_HEAD
175 ````
176
177 Which makes absolutely no sense, since the '.' repository is not even
178 documented, and FETCH_HEAD is a marginally known concept. In this case `git
179 fetch` is basically doing nothing from the user's point of view.
180
181 So the user can configure `fetch.default = simple` to get a simple sensible
182 default; `git fetch` will always use 'origin' by default.
183
184 If you use the "progress" mode, this option is also enabled.
185
186 ### Support for Ruby
187
188 There is partial optional support for Ruby. Git already has tooling so any
189 language can use it's plumbing and achieve plenty of tasks:
190
191 ```ruby
192 IO.popen(%w[git for-each-ref]) do |io|
193   io.each do |line|
194     sha1, kind, name = line.split()
195     # stuff
196   end
197 end
198 ```
199
200 However, this a) requires a process fork, and b) requires I/O communication to
201 get the desired data. While this is not a big deal on many systems, it is in
202 Windows systems where forks are slow, and many Git core programs don't work as
203 well as they do in Linux.
204
205 Git has a goal to replace all the core scripts with native C versions, but it's
206 a goal only in name that is not actually pursued. In addition, that still
207 leaves out any third party tools since Git doesn't provide a shared libgit
208 library, which is why an independent libgit2 was needed in the first place.
209
210 Ruby bindings solve these problems:
211
212 ```ruby
213 for_each_ref() do |name, sha1, flags|
214   # stuff
215 end
216 ```
217
218 The command `git ruby` can use this script by providing the bindings for many
219 Git's internal C functions (though not all), which makes it easier to write
220 Ruby programs that take full advantage of Git without any need of forks, or I/O
221 communication.
222
223 ## Contributions
224
225 All these patches were written by me, Felipe Contreras, but contributions from
226 other people are welcome, as long as they follow these guidelines:
227
228 1. Follows Git coding guidelines and is technically correct according to Git
229    standards
230 2. Doesn't break backwards compatibility
231 3. It doesn't conflict with other Git features so it can be rebased on newer
232    versions of Git without much maintenance burden
233
234 Patches should be sent using `git send-email` to the mailing list git-fc@googlegroups.com.