Skip to contentSkip to conversation

git-checkout doesn't understand -- separator

DISCUSSION Jakub Narebski 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

git-checkout doesn't understand '--' as a separator between <branch> (which is optional, but you can always write HEAD), and <path>...

1144:jnareb@roke:~/git> git checkout HEAD^ -- gitweb/gitweb.cgi
git-checkout-index: -- is not in the cache

Strange...

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#1 lore raw
Quoted 7 lines · Jakub Narebski

git-checkout doesn't understand '--' as a separator between <branch> (which is optional, but you can always write HEAD), and <path>...

1144:jnareb@roke:~/git> git checkout HEAD^ -- gitweb/gitweb.cgi
git-checkout-index: -- is not in the cache

Strange...

Perhaps...

git-checkout.sh +4 -0
index 5613bfc..580a9e8 100755
@@ -67,6 +67,10 @@ while [ "$#" != "0" ]; do
 			set x "$arg" "$@"
 			shift
 		fi
+		case "$1" in
+		--)
+			shift ;;
+		esac
 		break
 		;;
     esac