How do I fetch only one branch of a remote git repository?
I'd like to grab a single branch (not all of them) of a remote repository and create a local tracking branch that can track further updates to that remote branch. The other branches in the remote repository are very big, so I'd like to avoid fetching them. How do I do this?
Edit: I figured this out myself but StackOverflow refuses to let me provide the answer as an answer so I'll put it here in the question instead.
You use the -t option to git remote add, e.g.:
git remote add -t remote-branch remote-name remote-url
You can use multiple "
-t branch" options to grab multiple branches.
I have a remote repository with HTTPS access. git status lists only one entry: master git remote -v lists two entries to the same address: one for fetch, one for push But when I do git remote show ori
I have a project locally that I pushed to github. Each time I am trying to push a commit to github it asks me for the remote url. Can't I configure it so that it will automatically push to my desired
I have a git repository that has a remote set up (git fetch works), but it doesn't have any remote branches: the .git/refs/remotes folder doesn't exist, and git branch -r returns nothing (empty
I have setup git repository on a Linux Redhat machine. Users are setup in .htpasswd. The checkin/checkout is done using http (Apache is setup for this). How can i give read vs read/write permissions t
Which one takes more disk space? How do you track bug fixes(we are using Jira)? How do you know which branch or repository has the bug fix? there must be other advantages/disadvantages to repository v
I am using GIT on top of one centralized SVN repository. The SVN repository only contains trunk, no tags and branches. What I did before is using git svn to clone the remote repository to my local git
I just created a new git repository and only did one commit. Now I do not see a master branch. These are roughly the commands I ran. git init git checkout -b dev (I made some changes to the monitored
I have various Git projects that are on my local machine. I have a server that I would like to use as my remote Git Repository. How do I move my local Git Repositories (Projects) to my server while ke
How can I delete file from remote git repository? I have a file that is just deleted from working copy local repository, and I want delete it from corrispettive remote repository
I have trouble understanding how submodules work. I have a remote repository PARENT and a remote repository CHILD. I would like to make repository CHILD a submodule of repository PARENT, so when I ch
I've a branch on a remote repository and i want to bring that branch locally so i can do a rebase. I've added the repo of the remote branch which is called github. If i do git checkout -b feature/AIO
I have setup my local branch to track remote branch. when I do git pull, it said 'Already up-to-date'. But when I do git log, the latest checkin is on Dec 21, 2012'. And when I do git log remotes/bran
I made 5 commits to Master branch when bug hunting on a private project and pushed them to the remote origin (my own private vps). Then I saw that commits 4 and 5 were going to cause trouble elsewhere
i have commits that are in a remote repository (origin/master) which i want to put in a branch created from that repository (origin/remote_branch). when i checkout to that remote branch git checkout -
The problem is a simple one. I've used git cvsimport to import a cvs repo into a remote branch in a local git repository. I then wish to sync this repository: branches, tags, and all, to a git reposit
I have a git repository. When I do 'git branch', it said $ git branch * com-2.1-SS and then I do 'git log', i get a list of my commit $ git log commit ff878926b78614e8bf6af161da06070618e9ff6b commi
The Scenario: I'm working on a remote git repository with a team of say 20+. Branches are made, committed to and merged to master frequently. One colleague and I worked together on a branch for a coup
I am setting my local branch to track remote branch like this: $ git branch --set-upstream foo upstream/foo But when I do git status, I get: $ git status # On branch foo # Your branch and 'upstream/f
Possible Duplicate: Rolling back local and remote git repository by 1 commit How can I remove the last commit from a remote GIT repository such as I don't see it any more in the log? If for example
I have got a repository at github and several branches. The whole repo is about 2 gigs. Before moving to git, I had an ant script that would checkout a folder from svn repository, build binary files a
I have a deploy branch which differs from my master in that it contains various server-only asset files that I don't want polluting my master in development but I would like pushed to master on my ser
I'm using Git. I have some code in one branch that I want to get. Is there an easy way to get just the version of one file from a different branch or an easy way to make this other branch appear in an
When I use the git branch command, it displays only one local branch: master However, when I use the git branch -a command, it displays the initial master branch as well as two remote master branches:
Is there an automatic way to synchronise a local git repository with a remote one, for backup? Basically the structure that I'm envisaging is this: Master repository on a central server User A's P
All the remote branches are visible as remotes in my local git repository after a git fetch. How to selectively remove the remote branches in my local repository(not in the remote repository).
I worked on some code on a local branch and then I pushed it to a remote test repository with this command: git push origin fix_vouchers:fix_vouchers I'd like to change the active brank on that remot
When I do a git pull my repository automatically pulls from the original git repo that I cloned from. How can I get the URL of that git repository from the child repository?
If I push a bad initial commit (or more than one) to a remote repository and want to just clear it / destroy it - can I do it by a command? It's important to totally remove it from server so it doesn'
when I delete files from one branch it deletes from all branches. what can I do?
To delete a local branch in git I use git branch -d, but how do I safely remove a remote branch? I would like to delete it only when the remote branch is merged to my current branch.
In my current repo I have the following output: $ git branch -a * master remotes/origin/master remotes/public/master I want to delete 'remotes/public/master' from the branch list: $ git branch -d rem
I'm trying to synchronize periodically a git bare repository, my local branches are created using the --track option. here is my config (without unnecessary things): [core] bare = true [remote orig
I have pulled all remote branches via git fetch --all. I can see the branch I'd like to merge via git branch -a as remotes/origin/branchname. Problem is its not accessible. I can't merge or checkout?
I would like to know how I could clone only one branch instead of cloning the whole Git repository.
I could use a hand with learning how to push a local branch to a remote branch. Please see below. Help much appreciated! The local branch was created after cloning the repo then doing $ git checkout -
I would like to know if it's possible to use git with the following workflow: locally clone a remote repository make local changes commit them locally save them remotely so as not loose changes and i
If I create branches on my local git repos like so: git checkout -b test then do a push git push I don't actually see the new branch test in my GitHub page. How do I make my remote branches mirror my
Does the git fetch command copy down the entire remote repository to my machine, or just the upstream of my current branch?
i checked out a remote branch like git checkout -b newBranch origin/some-remote-branch. but whenever i do a push it is pushed to a new branch newBranch . how to tell git to automatically push to the b
So I set up a new remote git repo using the following lines: git remote add origin [link] git push origin master [enter password] In my previous repo, when I make a new commit and check status, it wi
I've checked the remote branch Design0.5: the last remote commit on that branch is identical to the top local commit, here marked (no branch). So locally, Design0.5 is 5 commits behind where I'd like
I cloned a repository, that has only one remote branch, namely master. After the cloning I get the message, that I'm in a detached HEAD state and git branch also says (no branch). Git log shows only t
Is it possible to make a branch in a remote master repository without having a local clone of the repository? The repository is large enough that cloning a copy just to make and push the branch is ext
I have two branches: local branch (the one which I work with) remote branch (public, only well-tested commits go there) Recently I seriously messed up my local branch (guess every git-newbie has bee
A git clone is set up to support pushing/pulling back into the original repository. How do I use git-remote (and/or other commands, configuration files, etc.) to change the two repositories such that
I want to check a local branch currently tracking which remote branch For example: git checkout -b test_branch git branch --set-upstream test_branch origin/remote_project001 But after a few days, I
I am working on a local git repository. There are two branches, master and feature_x. I want to push feature_x to the remote repo, but I do not want to push the changes on the master branch. Will a gi
Hey guys how would I checkout a specific branch from another remote address? Thanks
I am trying to pull some files from a different branch than the master branch. However, I get an error: fatal: 'origin' does not appear to be a git repository fatal: could not read from the remote rep
How do you know the version of the remote mercurial repository ? the remote repository i want to check version is accessible only via http protocol. the question is use correct client version of Mersu