aboutsummaryrefslogtreecommitdiff
path: root/git-reset.sh
Commit message (Collapse)AuthorAge
* Make "git reset" a builtin.Carlos Rica2007-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the script "git-reset.sh" with "builtin-reset.c". A few git commands used in the script are called from the builtin also: "ls-files" to check for unmerged files, "read-tree" for resetting the index file in "mixed" and "hard" resets, and "update-index" to refresh at the end in the "mixed" reset and also for the option that gets selected paths into the index. The reset option with paths was implemented by Johannes Schindelin. Since the option that gets selected paths into the index is not a "reset" like the others because it does not change the HEAD at all, now the command is showing a warning when the "--mixed" option is supplied for that purpose. The following table shows the behaviour of "git reset" for the different supported options, where X means "changing" the HEAD, index or working tree: reset: --soft --mixed --hard -- <paths> HEAD X X X - index - X X X files - - X - Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Rewrite "git-frotz" to "git frotz"Junio C Hamano2007-07-02
| | | | | | This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* add file checkout progressNicolas Pitre2007-04-23
| | | | | | | | | | It is nice to see what is happening when checking out large amount of files, either with git-checkout or git-reset. The new progress code already decides what is a "significant amount" and displays progress only in that case.. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Shell syntax fix in git-resetDavid Kågedal2007-01-18
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* Replace "echo -n" with printf in shell scripts.Jason Riedy2007-01-15
| | | | | | | | Not all echos know -n. This was causing a test failure in t5401-update-hooks.sh, but not t3800-mktag.sh for some reason. Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Use cd_to_toplevel in scripts that implement it by hand.Junio C Hamano2007-01-12
| | | | | | | | | | This converts scripts that do "cd $(rev-parse --show-cdup)" by hand to use cd_to_toplevel. I think git-fetch does not have to go to the toplevel, but that should be dealt with in a separate patch. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Disallow working directory commands in a bare repository.Shawn O. Pearce2007-01-10
| | | | | | | | | | | | | | | | If the user tries to run a porcelainish command which requires a working directory in a bare repository they may get unexpected results which are difficult to predict and may differ from command to command. Instead we should detect that the current repository is a bare repository and refuse to run the command there, as there is no working directory associated with it. [jc: updated Shawn's original somewhat -- bugs are mine.] Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-reset <tree> -- <path> restores absense of <path> in <tree>Junio C Hamano2007-01-06
| | | | | | | | When <path> exists in the index (either merged or unmerged), and <tree> does not have it, git-reset should be usable to restore the absense of it from the tree. This implements it. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Honor GIT_REFLOG_ACTION in git-rebase.Shawn O. Pearce2006-12-28
| | | | | | | | | To help correctly log actions caused by porcelain which invoke git-reset directly we should honor the setting of GIT_REFLOG_ACTION which we inherited from our caller. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-reset --hard: tell the user what the HEAD was reset toJohannes Schindelin2006-12-21
| | | | | Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-reset [--mixed] <tree> [--] <paths>...Junio C Hamano2006-12-14
| | | | | | | | | | | | | | | Sometimes it is asked on the list how to revert selected path in the index from a tree, most often HEAD, without affecting the files in the working tree. A similar operation that also affects the working tree files has been available in the form of "git checkout <tree> -- <paths>...". By definition --soft would never affect either the index nor the working tree files, and --hard is the way to make the working tree files as close to pristine, so this new option is available only for the default --mixed case. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-reset: make it work from within a subdirectory.Junio C Hamano2006-12-14
| | | | | | | | | | | If you typically sit in, say "src/", it's annoying to have to change directory to do a reset. This may need to be reworked when we add "git reset -- paths..." to encapsulate the "ls-tree $tree | update-index --index-info" pattern. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-reset to remove "$GIT_DIR/MERGE_MSG"v1.4.4.2Junio C Hamano2006-12-06
| | | | | | | | | | | | | | | | | | | | | | An earlier commit a9cb3c6e changed git-commit to use the contents of MERGE_MSG even when we do not have MERGE_HEAD (the rationale is in its log message). However, the change tricks the following sequence to include a merge message in a completely unrelated commit: $ git pull somewhere : oops, the conflicts are too much. forget it. $ git reset --hard : work work work $ git commit To fix this confusion, this patch makes "git reset" to remove the leftover MERGE_MSG that was prepared when the user abandoned the merge. Signed-off-by: Junio C Hamano <junkio@cox.net> Acked-by: Luben Tuikov <ltuikov@yahoo.com
* git-reset: remove unused variableRene Scharfe2006-08-27
| | | | | Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-reset: detect update-ref error and report it.Junio C Hamano2006-07-27
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-reset: complain and exit upon seeing an unknown parameter.Junio C Hamano2006-07-05
| | | | | | | | The check to use "rev-parse --verify" was defeated by the use of "--default HEAD". "git reset --hard bogus-committish" just defaulted to reset to the HEAD without complaining. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-merge --squashJunio C Hamano2006-06-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some people tend to do many little commits on a topic branch, recording all the trials and errors, and when the topic is reasonably cooked well, would want to record the net effect of the series as one commit on top of the mainline, removing the cruft from the history. The topic is then abandoned or forked off again from that point at the mainline. The barebone porcelainish that comes with core git tools does not officially support such operation, but you can fake it by using "git pull --no-merge" when such a topic branch is not a strict superset of the mainline, like this: git checkout mainline git pull --no-commit . that-topic-branch : fix conflicts if any rm -f .git/MERGE_HEAD git commit -a -m 'consolidated commit log message' git branch -f that-topic-branch ;# now fully merged This however does not work when the topic branch is a fast forward of the mainline, because normal "git pull" will never create a merge commit in such a case, and there is nothing special --no-commit could do to begin with. This patch introduces a new option, --squash, to support such a workflow officially in both fast-forward case and true merge case. The user-level operation would be the same in both cases: git checkout mainline git pull --squash . that-topic-branch : fix conflicts if any -- naturally, there would be : no conflict if fast forward. git commit -a -m 'consolidated commit log message' git branch -f that-topic-branch ;# now fully merged When the current branch is already up-to-date with respect to the other branch, there truly is nothing to do, so the new option does not have any effect. This was brought up in #git IRC channel recently. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Include ref log detail in commit, reset, etc.Shawn Pearce2006-05-19
| | | | | | | | When updating a ref at the direction of the user include a reason why head was changed as part of the ref log (assuming it was enabled). Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Simplify "git reset --hard"Linus Torvalds2006-05-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that the one-way merge strategy does the right thing wrt files that do not exist in the result, just remove all the random crud we did in "git reset" to do this all by hand. Instead, just pass in "-u" to git-read-tree when we do a hard reset, and depend on git-read-tree to update the working tree appropriately. This basically means that git reset turns into # Always update the HEAD ref git update-ref HEAD "$rev" case "--soft" # do nothing to index/working tree case "--hard" # read index _and_ update working tree git-read-tree --reset -u "$rev" case "--mixed" # update just index, report on working tree differences git-read-tree --reset "$rev" git-update-index --refresh which is what it was always semantically doing, it just did it in a rather strange way because it was written to not expect git-read-tree to do anything to the working tree. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-reset delete empty directoriesShawn Pearce2006-02-17
| | | | | | | | | | | | | | | When git-reset --hard is used and a subdirectory becomes empty (as it contains no tracked files in the target tree) the empty subdirectory should be removed. This matches the behavior of git-checkout-index and git-read-tree -m which would not have created the subdirectory or would have deleted it when updating the working directory. Subdirectories which are not empty will be left behind. This may happen if the subdirectory still contains object files from the user's build process (for example). [jc: simplified the logic a bit, while keeping the test script.]
* git-rerere: reuse recorded resolve.Junio C Hamano2006-02-06
| | | | | | | | | | | | | | | In a workflow that employs relatively long lived topic branches, the developer sometimes needs to resolve the same conflict over and over again until the topic branches are done (either merged to the "release" branch, or sent out and accepted upstream). This commit introduces a new command, "git rerere", to help this process by recording the conflicted automerge results and corresponding hand-resolve results on the initial manual merge, and later by noticing the same conflicted automerge and applying the previously recorded hand resolution using three-way merge. Signed-off-by: Junio C Hamano <junkio@cox.net>
* use GIT_DIR instead of /var/tmpAlex Riesen2006-01-05
| | | | | | | | Not every system (will not one microsoft windows system) have /var/tmp, whereas using GIT_DIR for random temporary files is more or less established. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Trivial usage string clean-upfreku045@student.liu.se2005-12-14
| | | | | Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-sh-setup: die if outside git repository.Junio C Hamano2005-11-25
| | | | | | | | Now all the users of this script detect its exit status and die, complaining that it is outside git repository. So move the code that dies from all callers to git-sh-setup script. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add usage help for git-reset.shc.shoemaker@cox.net2005-10-28
| | | | | Signed-off-by: Chris Shoemaker <c.shoemaker at cox.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Use git-update-ref in scripts.Junio C Hamano2005-09-28
| | | | | | | | | This uses the git-update-ref command in scripts for safer updates. Also places where we used to read HEAD ref by using "cat" were fixed to use git-rev-parse. This will matter when we start using symbolic references. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Remove use of 'xargs -0' from git-reset.Junio C Hamano2005-09-24
| | | | | | | | Even without the trouble it causes to people without GNU xargs, it was not really necessary to print from Perl and then remove it outside. Just unlink it inside Perl. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Squelch `removal' message from 'git reset --hard'.Junio C Hamano2005-09-08
| | | | | | | We do not say anything about checking out, so mentioning removal only gets unnecessarily alarming. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Big tool rename.Junio C Hamano2005-09-07
As promised, this is the "big tool rename" patch. The primary differences since 0.99.6 are: (1) git-*-script are no more. The commands installed do not have any such suffix so users do not have to remember if something is implemented as a shell script or not. (2) Many command names with 'cache' in them are renamed with 'index' if that is what they mean. There are backward compatibility symblic links so that you and Porcelains can keep using the old names, but the backward compatibility support is expected to be removed in the near future. Signed-off-by: Junio C Hamano <junkio@cox.net>