Christian Couder 9bc454df08 reset: add option "--keep" to "git reset"
The purpose of this new option is to discard some of the
last commits but to keep current changes in the work tree.

The use case is when you work on something and commit
that work. And then you work on something else that touches
other files, but you don't commit it yet. Then you realize
that what you commited when you worked on the first thing
is not good or belongs to another branch.

So you want to get rid of the previous commits (at least in
the current branch) but you want to make sure that you keep
the changes you have in the work tree. And you are pretty
sure that your changes are independent from what you
previously commited, so you don't want the reset to succeed
if the previous commits changed a file that you also
changed in your work tree.

The table below shows what happens when running
"git reset --keep target" to reset the HEAD to another
commit (as a special case "target" could be the same as
HEAD).

working index HEAD target         working index HEAD
----------------------------------------------------
  A      B     C     D   --keep    (disallowed)
  A      B     C     C   --keep     A      C     C
  B      B     C     D   --keep    (disallowed)
  B      B     C     C   --keep     B      C     C

In this table, A, B and C are some different states of
a file. For example the last line of the table means
that if a file is in state B in the working tree and
the index, and in a different state C in HEAD and in
the target, then "git reset --keep target" will put
the file in state B in the working tree, and in state
C in the index and in HEAD.

The following table shows what happens on unmerged entries:

working index HEAD target         working index HEAD
----------------------------------------------------
 X       U     A    B     --keep  (disallowed)
 X       U     A    A     --keep   X       A     A

In this table X can be any state and U means an unmerged
entry.

Though the error message when "reset --keep" is disallowed
on unmerged entries is something like:

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

which is not very nice.

A following patch will add some test cases for "--keep".

The "--keep" option is implemented by doing a 2 way merge
between HEAD and the reset target, and if this succeeds
by doing a mixed reset to the target.

The code comes from the sequencer GSoC project, where
such an option was developed by Stephan Beyer:

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

(at commit 5a78908b70ceb5a4ea9fd4b82f07ceba1f019079)

But in the sequencer project the "reset" flag was set
in the "struct unpack_trees_options" passed to
"unpack_trees()". With this flag the changes in the
working tree were discarded if the file was different
between HEAD and the reset target.

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-24 17:46:41 -08:00
2010-01-24 17:35:58 -08:00
2010-01-13 12:30:39 -08:00
2009-09-14 02:23:36 -07:00
2010-01-20 14:42:59 -08:00
2010-01-20 14:42:59 -08:00
2010-01-16 20:39:59 -08:00
2010-01-16 20:39:59 -08:00
2010-01-20 14:37:25 -08:00
2010-01-13 12:30:39 -08:00
2009-12-22 12:32:39 -08:00
2010-01-22 16:08:19 -08:00
2010-01-13 11:58:34 -08:00
2009-12-26 14:03:16 -08:00
2009-12-03 10:08:54 -08:00
2009-08-05 12:39:33 -07:00
2010-01-22 10:01:33 -08:00
2010-01-16 16:39:58 -08:00
2010-01-22 16:08:16 -08:00
2010-01-21 22:04:42 -08:00
2009-08-07 22:35:17 -07:00
2010-01-22 10:10:27 -08:00
2009-11-23 22:30:08 -08:00
2010-01-24 17:35:58 -08:00
2009-11-20 23:53:55 -08:00
2010-01-20 14:39:52 -08:00
2009-12-26 14:03:16 -08:00
2009-11-23 22:24:01 -08:00
2009-09-13 01:32:26 -07:00
2009-05-01 16:07:29 -07:00
2010-01-20 14:37:17 -08:00
2009-05-20 00:02:24 -07:00
2009-06-18 09:22:46 -07:00
2010-01-24 17:35:58 -08:00
2010-01-24 17:35:58 -08:00
2010-01-24 17:35:58 -08:00
2010-01-13 11:58:34 -08:00
2010-01-20 14:37:25 -08:00
2010-01-13 11:58:34 -08:00
2009-12-08 22:47:09 -08:00
2009-12-13 23:40:24 -08:00
2010-01-18 18:13:01 -08:00
2010-01-20 13:29:21 -08:00
2010-01-22 10:10:27 -08:00
2010-01-13 01:04:54 -08:00
2010-01-21 20:03:45 -08:00
2009-04-22 19:02:12 -07:00
2010-01-12 01:06:09 -08:00
2010-01-12 01:06:09 -08:00
2010-01-21 20:08:31 -08:00
2010-01-17 22:49:36 -08:00
2010-01-17 22:49:36 -08:00
2010-01-22 10:10:27 -08:00
2010-01-22 10:10:27 -08:00
2010-01-20 12:44:59 -08:00
2010-01-21 20:08:31 -08:00
2010-01-09 23:34:10 -08:00
2010-01-09 23:34:10 -08:00
2010-01-20 14:46:35 -08:00
2010-01-22 16:08:16 -08:00
2009-11-04 17:58:15 -08:00
2010-01-21 20:03:45 -08:00
2010-01-22 16:08:13 -08:00
2010-01-21 20:03:45 -08:00
2009-11-04 17:58:15 -08:00
2010-01-20 20:28:50 -08:00
2010-01-22 16:08:10 -08:00
2010-01-17 22:49:36 -08:00
2009-08-30 22:04:46 -07:00
2009-08-23 17:11:28 -07:00
2009-04-20 13:44:14 -07:00
2010-01-24 17:35:58 -08:00
2010-01-24 17:35:58 -08:00
2009-12-10 16:20:59 -08:00
2009-11-22 16:14:48 -08:00
2010-01-16 20:39:59 -08:00
2010-01-12 01:06:09 -08:00
2010-01-12 01:06:09 -08:00
2009-07-22 21:57:41 -07:00
2010-01-16 20:39:59 -08:00
2010-01-22 16:08:10 -08:00

////////////////////////////////////////////////////////////////

	GIT - the stupid content tracker

////////////////////////////////////////////////////////////////

"git" can mean anything, depending on your mood.

 - random three-letter combination that is pronounceable, and not
   actually used by any common UNIX command.  The fact that it is a
   mispronunciation of "get" may or may not be relevant.
 - stupid. contemptible and despicable. simple. Take your pick from the
   dictionary of slang.
 - "global information tracker": you're in a good mood, and it actually
   works for you. Angels sing, and a light suddenly fills the room.
 - "goddamn idiotic truckload of sh*t": when it breaks

Git is a fast, scalable, distributed revision control system with an
unusually rich command set that provides both high-level operations
and full access to internals.

Git is an Open Source project covered by the GNU General Public License.
It was originally written by Linus Torvalds with help of a group of
hackers around the net. It is currently maintained by Junio C Hamano.

Please read the file INSTALL for installation instructions.

See Documentation/gittutorial.txt to get started, then see
Documentation/everyday.txt for a useful minimum set of commands, and
Documentation/git-commandname.txt for documentation of each command.
If git has been correctly installed, then the tutorial can also be
read with "man gittutorial" or "git help tutorial", and the
documentation of each command with "man git-commandname" or "git help
commandname".

CVS users may also want to read Documentation/gitcvs-migration.txt
("man gitcvs-migration" or "git help cvs-migration" if git is
installed).

Many Git online resources are accessible from http://git-scm.com/
including full documentation and Git related tools.

The user discussion and development of Git take place on the Git
mailing list -- everyone is welcome to post bug reports, feature
requests, comments and patches to git@vger.kernel.org. To subscribe
to the list, send an email with just "subscribe git" in the body to
majordomo@vger.kernel.org. The mailing list archives are available at
http://marc.theaimsgroup.com/?l=git and other archival sites.

The messages titled "A note from the maintainer", "What's in
git.git (stable)" and "What's cooking in git.git (topics)" and
the discussion following them on the mailing list give a good
reference for project status, development direction and
remaining tasks.
Description
Git with broken hash generation to generate collisions between object IDs. Don't use this!
https://undefinedbehavior.de/posts/commit-vandalism/
Readme 217 MiB
Languages
C 50%
Shell 38.2%
Perl 5.5%
Tcl 3.5%
Python 0.9%
Other 1.7%