Skip to contentSkip to conversation

git remote add should be able to extend remotes

PATCH New Jonathan Nieder 1 participant 2 messages Jun 15, 2016 1 message not in the archive Documentation

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

reassign 432557 git git/1:1.5.2.3-1
found 432557 git/1:1.7.1-1
tags 432557 + upstream
quit

Hi Martin,

Sorry for the long silence.

Quoted 8 lines · martin f krafft

piper:/tmp/cdt.xBt19067/host1> git remote add -t A -t B base ../base piper:/tmp/cdt.xBt19067/host1> git remote add -t C base ../base remote base already exists.

It would be nice if I could add branches to be tracked in a given remote, ideally without having to specify the path:

git remote add -t C base

Yes, this seems like useful functionality.

It would be handy to be able to remove branches, too. I have not really wrapped my head around the set-* subcommands, but how about something like this?

git remote set-branches base --add C
git remote set-branches base A B D
git remote set-branches base --delete D; # not implemented

---
 Documentation/git-remote.txt |   13 +++++
 builtin/remote.c             |  102 +++++++++++++++++++++++++++++++++++++-----
 t/t5505-remote.sh            |   88 ++++++++++++++++++++++++++++++++++++
 3 files changed, 192 insertions(+), 11 deletions(-)
Documentation/git-remote.txt +13 -0
index 3fc599c..de4386b 100644
@@ -14,6 +14,7 @@ SYNOPSIS
 'git remote rename' <old> <new>
 'git remote rm' <name>
 'git remote set-head' <name> (-a | -d | <branch>)
+'git remote set-branches' <name> [--add] <branch>...
 'git remote set-url' [--push] <name> <newurl> [<oldurl>]
 'git remote set-url --add' [--push] <name> <newurl>
 'git remote set-url --delete' [--push] <name> <url>
@@ -104,6 +105,18 @@ remote set-head origin master" will set `$GIT_DIR/refs/remotes/origin/HEAD` to
 `refs/remotes/origin/master` already exists; if not it must be fetched first.
 +
 
+'set-branches'::
+
+Changes the list of branches tracked by the named remote.
+This can be used to track a subset of the available remote branches
+after the initial setup for a remote.
++
+The named branches will be interpreted as if specified with the
+`-t` option on the 'git remote add' command line.
++
+With `--add`, instead of replacing the list of currently tracked
+branches, adds to that list.
+
 'set-url'::
 
 Changes URL remote points to. Sets first URL remote points to matching
builtin/remote.c +91 -11

138 lines not on this page · raw message

t/t5505-remote.sh +88 -0

94 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH 1/1 Add git remote set-branches

Add ‘git remote set-branches’ for changing the list of tracked refs for a remote repository with one "porcelain-level" command. This complements the longstanding ‘git remote add --track’ option.

The interface is based on the ‘git remote set-url’ subcommand.

git remote set-branches base --add C
git remote set-branches base A B D
git remote set-branches base --delete D; # not implemented

---

Quoted 2 lines · Junio C Hamano

This, and the other patch, look Ok except these unsightly debbugs cruft in the commit log message. Could you redo them please?

Sorry about that. Hoping someone would take inspiration from my rough sketch and finish it off, I didn’t even bother to consider whether it might be usable as-is.

 Documentation/git-remote.txt |   13 +++++
 builtin/remote.c             |  102 +++++++++++++++++++++++++++++++++++++-----
 t/t5505-remote.sh            |   88 ++++++++++++++++++++++++++++++++++++
 3 files changed, 192 insertions(+), 11 deletions(-)
Documentation/git-remote.txt +13 -0
index 3fc599c..de4386b 100644
@@ -14,6 +14,7 @@ SYNOPSIS
 'git remote rename' <old> <new>
 'git remote rm' <name>
 'git remote set-head' <name> (-a | -d | <branch>)
+'git remote set-branches' <name> [--add] <branch>...
 'git remote set-url' [--push] <name> <newurl> [<oldurl>]
 'git remote set-url --add' [--push] <name> <newurl>
 'git remote set-url --delete' [--push] <name> <url>
@@ -104,6 +105,18 @@ remote set-head origin master" will set `$GIT_DIR/refs/remotes/origin/HEAD` to
 `refs/remotes/origin/master` already exists; if not it must be fetched first.
 +
 
+'set-branches'::
+
+Changes the list of branches tracked by the named remote.
+This can be used to track a subset of the available remote branches
+after the initial setup for a remote.
++
+The named branches will be interpreted as if specified with the
+`-t` option on the 'git remote add' command line.
++
+With `--add`, instead of replacing the list of currently tracked
+branches, adds to that list.
+
 'set-url'::
 
 Changes URL remote points to. Sets first URL remote points to matching
builtin/remote.c +91 -11

138 lines not on this page · raw message

t/t5505-remote.sh +88 -0

94 lines not on this page · raw message

Signature · 1 line
1.7.1