[PATCH 1/7] remote: Make "-" an alias for the current remote

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This creates a handy alias "-" for the remote of the current branch
(or origin if no such remote exists), which can be used in both
push, pull, fetch and remote to make many tasks easier. E.g.:
git push - HEAD  : push the current branch
git remote prune - : prune the current remote
git fetch - next : get the next branch from the current remote

Signed-off-by: Finn Arne Gangstad <finnag@xxxxxxx>
---
 remote.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/remote.c b/remote.c
index d7079c6..3a6d002 100644
--- a/remote.c
+++ b/remote.c
@@ -645,7 +645,7 @@ struct remote *remote_get(const char *name)
 	struct remote *ret;
 
 	read_config();
-	if (!name)
+	if (!name || !strcmp(name, "-"))
 		name = default_remote_name;
 	ret = make_remote(name, 0);
 	if (valid_remote_nick(name)) {
-- 
1.6.2.105.g6ff1f.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux