mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 15:36:21 -04:00
Reset single file to HEAD or certain commit-hash - add git-reset-file - add respective man files
18 lines
294 B
Bash
Executable file
18 lines
294 B
Bash
Executable file
#!/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
|