6940

How to config namespace for 'private' branches in git?

Question:

Is it possible to config git repository not to fetch branches from certain namespaces of the origin repository by default?

What I want is to put my current work in some namespace so that everyone else know it is not ready yet. For example, if I config namespace a like that:

[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* fetch = +refs/heads/a/*:refs/remotes/origin/a/* push = +refs/heads/a/*:refs/heads/a/* url = some_git_url

Others would have fetch = +refs/heads/*:refs/remotes/origin/* line but not fetch = +refs/heads/a/*:refs/remotes/origin/a/*. Of course they can fetch branch from my /a/ namespace. But I want that not to happen by default so that my working commits don't clutter others' history graphs.

The problem is that it seems refs/heads/* includes nested namespaces. So when I do git fetch on any machine - I still get everything from /a/ namespace.

Is there a way to config git like I want? To tell git to fetch only immediate branches from refs/heads/?

Answer1:

Keep your working branches locally and only push the shared branches. Ask others to do the same.

That's assuming you're all sharing a central repository as a remote, rather than pushing/pulling to and from each other's local repositories.

Recommend

  • How can I tell which files have been marked as “assume unchanged” in git
  • Why doesn't `git diff` invoke external diff tool?
  • Why does “git svn fetch” command seem to be stuck and does nothing?
  • Method 'exec' doesn't work in grunt task
  • Change GIT login/username in IntelliJ IDEA, RubyMine etc
  • Browser client using autobahn.js can not connect to Ratchet Websocket Server
  • Git clone issue in cake
  • Can't pull or push after git clone - local changes
  • Rename a merged commit without losing that commit's parents
  • Push refs/remotes to new origin, how?
  • List or scalar context when returning an array or list with a single element
  • How does git deal with identical branch names from two different remote repo?
  • Switch to a remote branch getting detached head [duplicate]
  • git receive-pack stops with 0000
  • Github ERROR: Repository not found (yes, another one)
  • Inserting Array References into Perl Heap
  • “git push” doing the same as “git fetch” from the remote
  • C++ Coin flip program error
  • string.IsNullOrEmpty() Doesn't Seem to Work on a String within a Class within a Class
  • Can my app be notified when another application starts/stops playing audio?
  • WPF Template Binding in ToggleButton UserControl
  • Uncaught TypeError: $(…).select2 is not a function
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • Button click event not firing in jQuery
  • chrome.tabs.executeScript only fires when the Developer Console is open
  • JSON response opens as a file, but I can't access it with JavaScript
  • SignalR .NET Client Invoke throws an exception
  • Azure Cloud Service Web Role web pages do not load
  • R: gsub and capture
  • Circular dependency while pushing http interceptor
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • Comma separated Values
  • AngularJs get employee from factory
  • How to set the response of a form post action to a iframe source?
  • coudnt use logback because of log4j
  • Change div Background jquery
  • Checking variable from a different class in C#
  • git trying to push non-existent file … after clearing cache
  • How to push additional view controllers onto NavigationController but keep the TabBar?
  • How to load view controller without button in storyboard?