mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
ADD: git-reset-file
Reset single file to HEAD or certain commit-hash - add git-reset-file - add respective man files
This commit is contained in:
parent
aa5457c14c
commit
b94fdd11c2
17
Readme.md
17
Readme.md
|
|
@ -70,6 +70,7 @@ $ brew install git-extras
|
|||
- `git missing`
|
||||
- `git lock`
|
||||
- `git unlock`
|
||||
- `git reset-file`
|
||||
|
||||
## git-extras
|
||||
|
||||
|
|
@ -651,3 +652,19 @@ $ git lock config/database.yml
|
|||
## git-unlock [filename]
|
||||
|
||||
Unlock a local file `filename`
|
||||
|
||||
## git-reset-file [filename] commit
|
||||
|
||||
Reset one file to `HEAD` or certain commit
|
||||
|
||||
Reset one file to HEAD
|
||||
|
||||
```bash
|
||||
$ git reset-file .htaccess
|
||||
```
|
||||
|
||||
or reset one file to certain commit
|
||||
|
||||
```bash
|
||||
$ git reset-file .htaccess dc82b19
|
||||
```
|
||||
|
|
|
|||
17
bin/git-reset-file
Executable file
17
bin/git-reset-file
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
file="$1"
|
||||
commit="$2"
|
||||
|
||||
if [[ -f $file ]]; then
|
||||
git rm --cached -q -f -- $file
|
||||
if [[ -z $commit ]]; then
|
||||
git checkout HEAD -- $file
|
||||
echo "Reset '$1' to HEAD"
|
||||
else
|
||||
git checkout $commit -- $file
|
||||
echo "Reset '$1' to $commit"
|
||||
fi
|
||||
else
|
||||
echo "File '$1' not found in `pwd`"
|
||||
fi
|
||||
60
man/git-reset-file.1
Normal file
60
man/git-reset-file.1
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "GIT\-RESET\-FILE" "1" "August 2014" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBgit\-reset\-file\fR \- Reset one file
|
||||
.
|
||||
.SH "SYNOPSIS"
|
||||
\fBgit\-reset\-file\fR [<filename>] commit\-hash
|
||||
.
|
||||
.SH "DESCRIPTION"
|
||||
Reset one file to HEAD or certain commit\-hash
|
||||
.
|
||||
.SH "OPTIONS"
|
||||
<filename>
|
||||
.
|
||||
.P
|
||||
The name of the file to reset\.
|
||||
.
|
||||
.P
|
||||
<commit\-hash>
|
||||
.
|
||||
.P
|
||||
(Optional) Hash of commit to reset the file to\. Defaults to HEAD\.
|
||||
.
|
||||
.SH "EXAMPLES"
|
||||
Reset one file to HEAD
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
$ git reset\-file \.htaccess
|
||||
.
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
or reset one file to certain commit
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
$ git reset\-file \.htaccess dc82b19
|
||||
.
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.SH "AUTHOR"
|
||||
Written by Sasha Khamkov <\fIsanusart@gmail\.com\fR>
|
||||
.
|
||||
.SH "REPORTING BUGS"
|
||||
<\fIhttps://github\.com/visionmedia/git\-extras/issues\fR>
|
||||
.
|
||||
.SH "SEE ALSO"
|
||||
<\fIhttps://github\.com/visionmedia/git\-extras\fR>
|
||||
128
man/git-reset-file.html
Normal file
128
man/git-reset-file.html
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
||||
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
||||
<title>git-reset-file(1) - Reset one file</title>
|
||||
<style type='text/css' media='all'>
|
||||
/* style: man */
|
||||
body#manpage {margin:0}
|
||||
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
||||
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
||||
.mp h2 {margin:10px 0 0 0}
|
||||
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
||||
.mp h3 {margin:0 0 0 4ex}
|
||||
.mp dt {margin:0;clear:left}
|
||||
.mp dt.flush {float:left;width:8ex}
|
||||
.mp dd {margin:0 0 0 9ex}
|
||||
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
||||
.mp pre {margin-bottom:20px}
|
||||
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
||||
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
||||
.mp img {display:block;margin:auto}
|
||||
.mp h1.man-title {display:none}
|
||||
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
||||
.mp h2 {font-size:16px;line-height:1.25}
|
||||
.mp h1 {font-size:20px;line-height:2}
|
||||
.mp {text-align:justify;background:#fff}
|
||||
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
||||
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
||||
.mp u {text-decoration:underline}
|
||||
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
||||
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
||||
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
||||
.mp b.man-ref {font-weight:normal;color:#434241}
|
||||
.mp pre {padding:0 4ex}
|
||||
.mp pre code {font-weight:normal;color:#434241}
|
||||
.mp h2+pre,h3+pre {padding-left:0}
|
||||
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
||||
ol.man-decor {width:100%}
|
||||
ol.man-decor li.tl {text-align:left}
|
||||
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
||||
ol.man-decor li.tr {text-align:right;float:right}
|
||||
</style>
|
||||
</head>
|
||||
<!--
|
||||
The following styles are deprecated and will be removed at some point:
|
||||
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
||||
|
||||
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
||||
.man-navigation should be used instead.
|
||||
-->
|
||||
<body id='manpage'>
|
||||
<div class='mp' id='man'>
|
||||
|
||||
<div class='man-navigation' style='display:none'>
|
||||
<a href="#NAME">NAME</a>
|
||||
<a href="#SYNOPSIS">SYNOPSIS</a>
|
||||
<a href="#DESCRIPTION">DESCRIPTION</a>
|
||||
<a href="#OPTIONS">OPTIONS</a>
|
||||
<a href="#EXAMPLES">EXAMPLES</a>
|
||||
<a href="#AUTHOR">AUTHOR</a>
|
||||
<a href="#REPORTING-BUGS">REPORTING BUGS</a>
|
||||
<a href="#SEE-ALSO">SEE ALSO</a>
|
||||
</div>
|
||||
|
||||
<ol class='man-decor man-head man head'>
|
||||
<li class='tl'>git-reset-file(1)</li>
|
||||
<li class='tc'></li>
|
||||
<li class='tr'>git-reset-file(1)</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="NAME">NAME</h2>
|
||||
<p class="man-name">
|
||||
<code>git-reset-file</code> - <span class="man-whatis">Reset one file</span>
|
||||
</p>
|
||||
|
||||
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
||||
|
||||
<p><code>git-reset-file</code> [<filename>] commit-hash</p>
|
||||
|
||||
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
||||
|
||||
<p> Reset one file to HEAD or certain commit-hash</p>
|
||||
|
||||
<h2 id="OPTIONS">OPTIONS</h2>
|
||||
|
||||
<p> <filename></p>
|
||||
|
||||
<p> The name of the file to reset.</p>
|
||||
|
||||
<p> <commit-hash></p>
|
||||
|
||||
<p> (Optional) Hash of commit to reset the file to. Defaults to HEAD.</p>
|
||||
|
||||
<h2 id="EXAMPLES">EXAMPLES</h2>
|
||||
|
||||
<p> Reset one file to HEAD</p>
|
||||
|
||||
<pre><code>$ git reset-file .htaccess
|
||||
</code></pre>
|
||||
|
||||
<p> or reset one file to certain commit</p>
|
||||
|
||||
<pre><code>$ git reset-file .htaccess dc82b19
|
||||
</code></pre>
|
||||
|
||||
<h2 id="AUTHOR">AUTHOR</h2>
|
||||
|
||||
<p>Written by Sasha Khamkov <<a href="mailto:sanusart@gmail.com" data-bare-link="true">sanusart@gmail.com</a>></p>
|
||||
|
||||
<h2 id="REPORTING-BUGS">REPORTING BUGS</h2>
|
||||
|
||||
<p><<a href="https://github.com/visionmedia/git-extras/issues" data-bare-link="true">https://github.com/visionmedia/git-extras/issues</a>></p>
|
||||
|
||||
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
||||
|
||||
<p><<a href="https://github.com/visionmedia/git-extras" data-bare-link="true">https://github.com/visionmedia/git-extras</a>></p>
|
||||
|
||||
|
||||
<ol class='man-decor man-foot man foot'>
|
||||
<li class='tl'></li>
|
||||
<li class='tc'>August 2014</li>
|
||||
<li class='tr'>git-reset-file(1)</li>
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
42
man/git-reset-file.md
Normal file
42
man/git-reset-file.md
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
git-reset-file(1) -- Reset one file
|
||||
================================
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
`git-reset-file` [<filename>] commit-hash
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
Reset one file to HEAD or certain commit-hash
|
||||
|
||||
## OPTIONS
|
||||
|
||||
<filename>
|
||||
|
||||
The name of the file to reset.
|
||||
|
||||
<commit-hash>
|
||||
|
||||
(Optional) Hash of commit to reset the file to. Defaults to HEAD.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
Reset one file to HEAD
|
||||
|
||||
$ git reset-file .htaccess
|
||||
|
||||
or reset one file to certain commit
|
||||
|
||||
$ git reset-file .htaccess dc82b19
|
||||
|
||||
## AUTHOR
|
||||
|
||||
Written by Sasha Khamkov <<sanusart@gmail.com>>
|
||||
|
||||
## REPORTING BUGS
|
||||
|
||||
<<https://github.com/visionmedia/git-extras/issues>>
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
<<https://github.com/visionmedia/git-extras>>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
# manuals
|
||||
git-alias(1) git-alias
|
||||
git-archive-file(1) git-archive-file
|
||||
git-back(1) git-back
|
||||
git-bug(1) git-bug
|
||||
git-changelog(1) git-changelog
|
||||
|
|
@ -14,19 +15,25 @@ git-delete-tag(1) git-delete-tag
|
|||
git-effort(1) git-effort
|
||||
git-extras(1) git-extras
|
||||
git-feature(1) git-feature
|
||||
git-fork(1) git-fork
|
||||
git-fresh-branch(1) git-fresh-branch
|
||||
git-gh-pages(1) git-gh-pages
|
||||
git-graft(1) git-graft
|
||||
git-ignore(1) git-ignore
|
||||
git-info(1) git-info
|
||||
git-local-commits(1) git-local-commits
|
||||
git-lock(1) git-lock
|
||||
git-missing(1) git-missing
|
||||
git-rebase-patch(1) git-rebase-patch
|
||||
git-refactor(1) git-refactor
|
||||
git-release(1) git-release
|
||||
git-rename-tag(1) git-rename-tag
|
||||
git-repl(1) git-repl
|
||||
git-reset-file(1) git-reset-file
|
||||
git-setup(1) git-setup
|
||||
git-show-tree(1) git-show-tree
|
||||
git-squash(1) git-squash
|
||||
git-summary(1) git-summary
|
||||
git-touch(1) git-touch
|
||||
git-undo(1) git-undo
|
||||
git-unlock(1) git-unlock
|
||||
|
|
|
|||
Loading…
Reference in a new issue