Commit graph

51 commits

Author SHA1 Message Date
Thomas Rast 6e90f7b8df Documentation/reset: move "undo permanently" example behind "make topic"
I consider the latter usage more important.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-19 09:12:42 -07:00
Thomas Rast 8bb95bbca7 Documentation/reset: reorder examples to match description
A previous commit moved the <paths> mode (undoes git-add) to the front
in the description, so make the examples follow the same order.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-19 09:12:07 -07:00
Thomas Rast 28bb4b276a Documentation/reset: promote 'examples' one section up
Move the examples section upwards, before the discussion that gives
the gory details.  Adjust the style of the heading accordingly.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-19 09:10:24 -07:00
Thomas Rast 7b8cd49d5c Documentation/reset: separate options by mode
Remove all but -q from the OPTIONS section, and instead explain the
options separated by usage mode, since they only apply to one each.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-19 08:11:33 -07:00
Thomas Rast bb59b7fffc Documentation/git-reset: reorder modes for soft-mixed-hard progression
Reorder the documetation so that the soft/mixed/hard modes are in this
order.  This way they form a natural progression towards changing more
of the state.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-19 08:11:04 -07:00
Junio C Hamano eaf436c09c Documentation: improve description of "git reset --keep"
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-08 18:16:05 -08:00
Christian Couder 812d2a3d61 reset: disallow using --keep when there are unmerged entries
The use case for --keep option is to remove previous commits unrelated
to the current changes in the working tree. So in this use case we are
not supposed to have unmerged entries. This is why it seems safer to
just disallow using --keep when there are unmerged entries.

And this patch changes the error message when --keep was disallowed and
there were some unmerged entries from:

    error: Entry 'file1' would be overwritten by merge. Cannot merge.
    fatal: Could not reset index file to revision 'HEAD^'.

to:

    fatal: Cannot do a keep reset in the middle of a merge.

which is nicer.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-06 20:06:50 -08:00
Christian Couder 7349df1142 Documentation: reset: describe new "--keep" option
and give an example to show how it can be used.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-06 20:05:18 -08:00
Junio C Hamano add0951ab0 Merge remote branch 'remotes/trast-doc/for-next'
* remotes/trast-doc/for-next:
  Documentation: spell 'git cmd' without dash throughout
  Documentation: format full commands in typewriter font
  Documentation: warn prominently against merging with dirty trees
  Documentation/git-merge: reword references to "remote" and "pull"

Conflicts:
	Documentation/config.txt
	Documentation/git-config.txt
	Documentation/git-merge.txt
2010-01-20 20:28:49 -08:00
Junio C Hamano dc96c5ee70 Merge branch 'cc/reset-more'
* cc/reset-more:
  t7111: check that reset options work as described in the tables
  Documentation: reset: add some missing tables
  Fix bit assignment for CE_CONFLICTED
  "reset --merge": fix unmerged case
  reset: use "unpack_trees()" directly instead of "git read-tree"
  reset: add a few tests for "git reset --merge"
  Documentation: reset: add some tables to describe the different options
  reset: improve mixed reset error message when in a bare repo
2010-01-13 11:58:56 -08:00
Thomas Rast 0b444cdb19 Documentation: spell 'git cmd' without dash throughout
The documentation was quite inconsistent when spelling 'git cmd' if it
only refers to the program, not to some specific invocation syntax:
both 'git-cmd' and 'git cmd' spellings exist.

The current trend goes towards dashless forms, and there is precedent
in 647ac70 (git-svn.txt: stop using dash-form of commands.,
2009-07-07) to actively eliminate the dashed variants.

Replace 'git-cmd' with 'git cmd' throughout, except where git-shell,
git-cvsserver, git-upload-pack, git-receive-pack, and
git-upload-archive are concerned, because those really live in the
$PATH.
2010-01-10 13:01:28 +01:00
Christian Couder 397d596f84 Documentation: reset: add some missing tables
and while at it also explain why --merge option is disallowed in some
cases.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-04 23:37:47 -08:00
Junio C Hamano e11d7b5969 "reset --merge": fix unmerged case
Commit 9e8ecea (Add 'merge' mode to 'git reset', 2008-12-01) disallowed
"git reset --merge" when there was unmerged entries.  But it wished if
unmerged entries were reset as if --hard (instead of --merge) has been
used.  This makes sense because all "mergy" operations makes sure that
any path involved in the merge does not have local modifications before
starting, so resetting such a path away won't lose any information.

The previous commit changed the behavior of --merge to accept resetting
unmerged entries if they are reset to a different state than HEAD, but it
did not reset the changes in the work tree, leaving the conflict markers
in the resulting file in the work tree.

Fix it by doing three things:

 - Update the documentation to match the wish of original "reset --merge"
   better, namely, "An unmerged entry is a sign that the path didn't have
   any local modification and can be safely resetted to whatever the new
   HEAD records";

 - Update read_index_unmerged(), which reads the index file into the cache
   while dropping any higher-stage entries down to stage #0, not to copy
   the object name from the higher stage entry.  The code used to take the
   object name from the a stage entry ("base" if you happened to have
   stage #1, or "ours" if both sides added, etc.), which essentially meant
   that you are getting random results depending on what the merge did.

   The _only_ reason we want to keep a previously unmerged entry in the
   index at stage #0 is so that we don't forget the fact that we have
   corresponding file in the work tree in order to be able to remove it
   when the tree we are resetting to does not have the path.  In order to
   differentiate such an entry from ordinary cache entry, the cache entry
   added by read_index_unmerged() is marked as CE_CONFLICTED.

 - Update merged_entry() and deleted_entry() so that they pay attention to
   cache entries marked as CE_CONFLICTED.  They are previously unmerged
   entries, and the files in the work tree that correspond to them are
   resetted away by oneway_merge() to the version from the tree we are
   resetting to.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-03 16:01:05 -08:00
Stephan Beyer d0f379c2dc reset: use "unpack_trees()" directly instead of "git read-tree"
This patch makes "reset_index_file()" call "unpack_trees()" directly
instead of forking and execing "git read-tree". So the code is more
efficient.

And it's also easier to see which unpack_tree() options will be used,
as we don't need to follow "git read-tree"'s command line parsing
which is quite complex.

As Daniel Barkalow found, there is a difference between this new
version and the old one. The old version gives an error for
"git reset --merge" with unmerged entries, and the new version does
not when we reset the entries to some states that differ from HEAD.
Instead, it resets the index entry and succeeds, while leaving the
conflict markers in the corresponding file in the work tree (which
will be corrected by the next patch).

The code comes from the sequencer GSoC project:

git://repo.or.cz/git/sbeyer.git

(at commit 5a78908b70ceb5a4ea9fd4b82f07ceba1f019079)

Mentored-by: Daniel Barkalow <barkalow@iabervon.org>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-03 15:59:14 -08:00
Christian Couder 4086010c7c Documentation: reset: add some tables to describe the different options
This patch adds a DISCUSSION section that contains some tables to
show how the different "git reset" options work depending on the
states of the files in the working tree, the index, HEAD and the
target commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-30 01:09:45 -08:00
Felipe Contreras 5d2dcc423e General --quiet improvements
'git reset' is missing --quiet, and 'git gc' is not using OPT__QUIET.
Let's fix that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-03 10:08:54 -08:00
Felipe Contreras a75d7b5409 Use 'fast-forward' all over the place
It's a compound word.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-24 23:50:28 -07:00
Thomas Rast d002ef4d94 Implement 'git reset --patch'
This introduces a --patch mode for git-reset.  The basic case is

  git reset --patch -- [files...]

which acts as the opposite of 'git add --patch -- [files...]': it
offers hunks for *un*staging.  Advanced usage is

  git reset --patch <revision> -- [files...]

which offers hunks from the diff between the index and <revision> for
forward application to the index.  (That is, the basic case is just
<revision> = HEAD.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-15 15:17:47 -07:00
Junio C Hamano c32f76f4d2 Merge branch 'lt/reset-merge'
* lt/reset-merge:
  Document "git-reset --merge"
  Add 'merge' mode to 'git reset'
2008-12-29 01:21:45 -08:00
Markus Heidelberg ec9f0ea3e6 Documentation: sync example output with git output
Don't confuse the user with old git messages.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-19 11:55:33 -08:00
Markus Heidelberg 53682f0c9e doc/git-reset: add reference to git-stash
The "Interrupted workflow" situation is a good example for using
git-stash.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-17 01:16:43 -08:00
Junio C Hamano 1b5b465fbd Document "git-reset --merge"
The commit log message for the feature made it sound as if this is a saner
version of --mixed, but the use case presented makes it clear that it is a
better variant of --hard when your changes and somebody else's changes are
mixed together.

Perhaps we would want to rewrite the example that shows the use of --hard
not to talk about recovering from a failed merge?

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-09 21:42:44 -08:00
Thomas Rast 97c33c6583 Documentation: Refer to git-rebase(1) to warn against rewriting
This points readers at the "Recovering from upstream rebase" warning
in git-rebase(1) when we talk about rewriting published history in the
'reset', 'commit --amend', and 'filter-branch' documentation.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-15 21:22:58 -07:00
Junio C Hamano 59eb68aa2b Update my e-mail address
The old cox.net address is still getting mails from gitters.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 12:14:42 -07:00
Jonathan Nieder ba020ef5eb manpages: italicize git command names (which were in teletype font)
The names of git commands are not meant to be entered at the
commandline; they are just names. So we render them in italics,
as is usual for command names in manpages.

Using

	doit () {
	  perl -e 'for (<>) { s/\`(git-[^\`.]*)\`/'\''\1'\''/g; print }'
	}
	for i in git*.txt config.txt diff*.txt blame*.txt fetch*.txt i18n.txt \
	        merge*.txt pretty*.txt pull*.txt rev*.txt urls*.txt
	do
	  doit <"$i" >"$i+" && mv "$i+" "$i"
	done
	git diff

.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-05 11:24:40 -07:00
Jonathan Nieder 483bc4f045 Documentation formatting and cleanup
Following what appears to be the predominant style, format
names of commands and commandlines both as `teletype text`.

While we're at it, add articles ("a" and "the") in some
places, italicize the name of the command in the manual page
synopsis line, and add a comma or two where it seems appropriate.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-01 17:20:16 -07:00
Christian Couder 9e1f0a85c6 documentation: move git(7) to git(1)
As the "git" man page describes the "git" command at the end-user
level, it seems better to move it to man section 1.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-06 11:18:28 -07:00
Pieter de Bie 965053b09a Documentation/git-reset: Add an example of resetting selected paths
Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16 10:57:05 -08:00
Pieter de Bie ceb4cacb42 Documentation/git-reset: don't mention --mixed for selected-paths reset
The option is accepted, but that is the only form selected-paths
variant of the reset command takes, so there is no point mentioning it.
And while we're at it, use the dashless git call.

Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16 10:56:24 -08:00
Junio C Hamano 3983caa531 Documentation/git-reset:
Since 3368d11 (Remove unnecessary git-rm --cached reference from
status output), the status output marks the "Added but not yet
committed" section as "Changes to be committed".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16 10:51:46 -08:00
Dan McGee 5162e69732 Documentation: rename gitlink macro to linkgit
Between AsciiDoc 8.2.2 and 8.2.3, the following change was made to the stock
Asciidoc configuration:

@@ -149,7 +153,10 @@
 # Inline macros.
 # Backslash prefix required for escape processing.
 # (?s) re flag for line spanning.
-(?su)[\\]?(?P<name>\w(\w|-)*?):(?P<target>\S*?)(\[(?P<attrlist>.*?)\])=
+
+# Explicit so they can be nested.
+(?su)[\\]?(?P<name>(http|https|ftp|file|mailto|callto|image|link)):(?P<target>\S*?)(\[(?P<attrlist>.*?)\])=
+
 # Anchor: [[[id]]]. Bibliographic anchor.
 (?su)[\\]?\[\[\[(?P<attrlist>[\w][\w-]*?)\]\]\]=anchor3
 # Anchor: [[id,xreflabel]]

This default regex now matches explicit values, and unfortunately in this
case gitlink was being matched by just 'link', causing the wrong inline
macro template to be applied. By renaming the macro, we can avoid being
matched by the wrong regex.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-06 18:41:44 -08:00
Marco Costalba cf9d58e4f3 Document git-reset defaults to HEAD if no commit is given
Signed-off by: Marco Costalba <mcostalba@gmail.com>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-04 22:01:28 -08:00
Gerrit Pape 521b53e5c7 git-reset: add -q option to operate quietly
Many git commands have a -q option to suppress output to stdout, let's
have it for git-reset too.

This was asked for by Joey Hess through
 http://bugs.debian.org/444933

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-06 00:18:39 -08:00
Sergei Organov d336fc096b Documentation: quote commit messages consistently.
Documentation quotes commit messages 14 times with double-quotes, and 7
times with single-quotes. The patch turns everything to double-quotes.

A nice side effect is that documentation becomes more Windoze-friendly
as AFAIK single quotes won't work there.

Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02 15:38:24 -07:00
Steve Hoelzer 434e6ef89d Try to be consistent with capitalization in the documentation
Signed-off-by: Steve Hoelzer <shoelzer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-01 18:15:43 -07:00
Gerrit Pape 41728d6942 Documentation/git-reset.txt: suggest git commit --amend in example.
In example 'Undo a commit and redo', refer to 'git commit --amend', as
this is the easier alternative.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-23 23:55:08 -07:00
Shawn O. Pearce d7f078b8b9 Convert update-index references in docs to add.
Since `git add` is the approved porcelain for an end-user to invoke
when they want to manipulate the index, porcelain documentation
should steer the user to this command rather than the pure plumbing
update-index.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-17 10:20:27 -08:00
Junio C Hamano 5fe3acc43d Documentation: merge-output is not too verbose now.
We've squelched output from merge-recursive, and git-merge when
used with recursive does not attempt the trivial one first
anymore, so there won't be "Trying ... Nope." messages now.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-14 21:31:30 -08:00
Junio C Hamano 6934dec895 Document git-reset <commit> -- <paths>... 2006-12-26 00:21:01 -08:00
Shawn O. Pearce 82dca84871 Align section headers of 'git status' to new 'git add'.
Now that 'git add' is considered a first-class UI for 'update-index'
and that the 'git add' documentation states "Even modified files
must be added to the set of changes about to be committed" we should
make the output of 'git status' align with that documentation and
common usage.

So now we see a status output such as:

  # Added but not yet committed:
  #   (will commit)
  #
  #       new file: x
  #
  # Changed but not added:
  #   (use "git add file1 file2" to include for commit)
  #
  #       modified:   x
  #
  # Untracked files:
  #   (use "git add" on files to include for commit)
  #
  #       y

which just reads better in the context of using 'git add' to
manipulate a commit (and not a checkin, whatever the heck that is).

We also now support 'color.status.added' as an alias for the existing
'color.status.updated', as this alias more closely aligns with the
current output and documentation.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-15 22:31:01 -08:00
Horst H. von Brand abda1ef590 Documentation: Spelling fixes
Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-03 23:54:55 -07:00
sean 2b5f3ed316 Several trivial documentation touch ups.
Move incorrect asciidoc level 2 titles back to level 1.

  Show output of git-name-rev in man page example.

  Reword sentences that begin with a period (.) in asciidoc
  numbered lists to work around conversion to man page bug.

  Mention that git-repack now calls git-prune-packed
  when the -d option is passed to it.

  [imap] section headers in the config file example need to be
  contained in a literal block.  imap.pass is the proper config
  file variable to use, not imap.password.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 14:21:18 -07:00
Sean Estabrooks 48aeecdcc1 Fix up remaining man pages that use asciidoc "callouts".
Unfortunately docbook does not allow a callout to be
referenced from inside a callout list description.
Rewrite one paragraph in git-reset man page to work
around this limitation.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
2006-04-28 14:31:36 -07:00
Fredrik Kuivinen 7bd7f2804d Remove trailing dot after short description
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-09 11:44:11 -08:00
J. Bruce Fields 8278ac2f4a Minor git-reset and git-commit documentation fixes
Minor copyediting of recent additions to git-commit and git-reset
documentation.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-21 19:11:51 -08:00
Junio C Hamano a0dfb48af7 Documentation: git-reset - interrupted workflow.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-13 13:17:55 -08:00
Junio C Hamano 3ae854c356 Examples of resetting.
Morten Welinder says examples of resetting is really about
recovering from botched commit/pulls.  I agree that pointers
from commands that cause a reset to be needed in the first place
would be very helpful.

Also reset examples did not mention "pull/merge" cases.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-16 18:23:33 -08:00
Junio C Hamano 1e2ccd3abc Documentation: more examples.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-12 23:24:06 -08:00
Andreas Ericsson 936a23420c git-reset.txt: Small fix + clarifications.
This basically translates the man-page from 'git-developerish' to plain
english, adding some almost-sample output from git-status so users can
recognize what will happen.

Also mention explicitly that --mixed updates the index, while --soft
doesn't. I understood the old text to mean "--mixed is exactly like
--soft, but verbose".

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-20 22:19:58 -08:00
Sergey Vlasov a7154e916c [PATCH] Documentation: Update all files to use the new gitlink: macro
The replacement was performed automatically by these commands:

	perl -pi -e 's/link:(git.+)\.html\[\1\]/gitlink:$1\[1\]/g' \
		README Documentation/*.txt
	perl -pi -e 's/link:git\.html\[git\]/gitlink:git\[7\]/g' \
		README Documentation/*.txt

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-20 15:07:52 -07:00