Skip to contentSkip to conversation

git checkout: add -t alias for --track

PATCH In review Miklos Vajna 3 participants 6 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git checkout: add -t alias for --track

---

Just like 'git checkout -q' is an alias for 'git checkout --quiet', I often type 'git checkout -t -b newname master', then realize I need '--track', but in fact '-t' is not used for anything else, so it can be just a short name for --track.

 Documentation/git-checkout.txt |    2 +-
 builtin-checkout.c             |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/git-checkout.txt +1 -1
index e11cddb..a644173 100644
@@ -47,7 +47,7 @@ OPTIONS
 	by linkgit:git-check-ref-format[1].  Some of these checks
 	may restrict the characters allowed in a branch name.
 
---track::
+-t, --track::
 	When creating a new branch, set up configuration so that git-pull
 	will automatically retrieve data from the start point, which must be
 	a branch. Use this if you always pull from the same upstream branch
builtin-checkout.c +1 -1
index 7deb504..1a93d13 100644
@@ -504,7 +504,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 		OPT__QUIET(&opts.quiet),
 		OPT_STRING('b', NULL, &opts.new_branch, "new branch", "branch"),
 		OPT_BOOLEAN('l', NULL, &opts.new_branch_log, "log for new branch"),
-		OPT_SET_INT( 0 , "track",  &opts.track, "track",
+		OPT_SET_INT('t', "track",  &opts.track, "track",
 			BRANCH_TRACK_EXPLICIT),
 		OPT_BOOLEAN('f', NULL, &opts.force, "force"),
 		OPT_BOOLEAN('m', NULL, &opts.merge, "merge"),
Signature · 1 line
1.5.5
#1 lore raw

I do not have anything against this, but I do not see how this is useful in practice, given that branch.autosetupmerge is true by default these days.

List?

#2 lore raw
Quoted 2 lines · Junio C Hamano

I do not have anything against this, but I do not see how this is useful in practice,...

Oops, wrong wording from a drunken panda who is not used to alcoholic beverage. Sorry.

What I meant to say was that this may be useful to _some_ degree but probably _not very much_.

I should go to bed now.

#3 lore raw
Quoted 2 lines · Junio C Hamano

What I meant to say was that this may be useful to _some_ degree but probably _not very much_.

Yes, it's just about my "having short option aliases are good" idea. Should I improve the commit message by mentioning that this is useful "in case you don't want to have branch.autosetupmerge set to true for some reason"?

#4 lore raw

Hi,

Quoted 8 lines · Miklos Vajna
Quoted 2 lines · Junio C Hamano

What I meant to say was that this may be useful to _some_ degree but probably _not very much_.

Yes, it's just about my "having short option aliases are good" idea. Should I improve the commit message by mentioning that this is useful "in case you don't want to have branch.autosetupmerge set to true for some reason"?

AFAIR you still need to specify --track if you want to setup tracking information for local branches, and have branch.autosetupmerge different than "always", but as always, I might be mistaken.

Ciao,
Dscho

#5 lore raw
Quoted 6 lines · Johannes Schindelin
Quoted 4 lines · Miklos Vajna
Quoted 2 lines · Junio C Hamano

What I meant to say was that this may be useful to _some_ degree but probably _not very much_.

Quoted 8 lines
Quoted 4 lines

Yes, it's just about my "having short option aliases are good" idea. Should I improve the commit message by mentioning that this is useful "in case you don't want to have branch.autosetupmerge set to true for some reason"?

AFAIR you still need to specify --track if you want to setup tracking information for local branches, and have branch.autosetupmerge different than "always", but as always, I might be mistaken.

Ah, you are right. The change is fine as-is regardless of the "autosetupmerge" thing.