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 Bourne shell script that will build the HEAD of a specified remote branch or a specified remote tag. The branch/tag is specified as input argument to the script. In the script I perform a git f
I would like to know if I can easily get the last commit sha from a remote repository and a specific branch. I could do a git fetch MY_REMOTE_REPO;git checkout BRANCH_X;git log -1; but it is heavy jus
I just recently created a branch in our subversion repository. Running git-svn does not see the branch for some reason. The only thing that I can think of is that the trunk is behind the branch becaus
I recently delete all file from current branch, with rm --cached command without delete .git folder. Then staged just one file in current branch. But when I try to push that file to remote repository,
I have a repository within a subdirectory, and now I would like to have the parent directories under version control too, but keep the current history of the repository. So with the following tree: a/
I recently used git-svn to clone an SVN repository, for the purposes of maintaining my own branch of an open-source project. I'm also working with others on this branch, so we use a shared Git reposit
Is there a way to set up a git repository, so that git pull defaults to one remote and git push defaults to another? I know I can set both by changing the value of the remote variable in branch sectio
A word of warning: I'm a n00b to git in general. My team uses feature branches in svn, and I'd like to use git-svn to track my work on a particular feature branch. I've been (roughly) following Andy D
How do I add an empty directory (that contains no files) to a Git repository?
So i've got something like this for a repository atm. D-Hewards-MacBook-Pro:project dheward$ git branch -r origin/master unfuddle/master Interestingly because it is the master branch of the unfuddle
I am new to git. I have done a clone of remote repo as follows git clone https://email@example.com/repo.git then I did git checkout master made some changes and committed these changes to my
I am forking from github.com/mantisbt/mantisbt which results in github.com/MYACCOUNT/mantisbt from where I clone it and checkout the branch (I am interested in) to my local machine. My issue is th
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
I want to override a specific branch that im currently in, in order to override/replace everything from the remote repository server. If i do git pull on that branch i always get a merge conflict beca
I've got a 2 web servers, one testing and one live. Both have their codebases managed with git. I develop on the testing server, then push the changes from a master branch on the testing server to the
Hey I am working on a local branch on an Android Project.I want to replace all code on my local branch with all the code on the remote master.When I try to do git pull origin master,it tries to merge
How does git svn fetch work? Where is that branch which is fetched so that I can merge or rebase with my master or other branch? Where is the data fetched because git remote doesn't give me anything o
Is it possible to delete a remote branch with hg-git? I can delete the tag locally (hg bm -d old-branch), but it's not obvious how to tell the git server to do the same.
The following command: $ git branch -a yields * develop master remotes/origin/HEAD -> origin/develop remotes/origin/develop remotes/origin/feature/foo remotes/origin/master but I don't want remote
I forked a repo on github but they than created another branch inside that repo. When I do git fetch upstream it does not create that branch in my repo. How do I do this?
Does the git fetch command copy down the entire remote repository to my machine, or just the upstream of my current branch?
I have my code in one branch in the team git repo. Now I need to transfer (i.e push) it into another branch of the same repo which team members are using. How can I do that ? I prefer using git bash
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
Pulling any branch from any repository from a computer inside the git server's LAN works. However, on any remote computer (not on the same LAN as the git server), pulling master from any repository wo
I want to create a new git repository of a folder under an existing git repository. I want the history to be preserved in the new repository. How do I create this new git repository?
A central git repository we use has two branches that diverged a long time ago. Someone accidentally merged the old branch into the newer one, causing some conflicts. Now I have a merge commit sitting
It's possible that I'm not really understanding how git works here, but I have a development git branch, and then I created a new branch called development_cached I switched to the development_cached
I have existing project and I want to add it in git local repository. How can I do that ?
I just wanted to create branch using git bash so anyone can give me guidance how to do it?
I have a git repository on Unfuddle, and a Windows machine I'm using with msysgit. I set up an SSH key on that machine using ssh-keygen, which gave me some key files. I copied the contents of the publ
My .git/config: [remote origin] url = firstname.lastname@example.org:nfpyfzyf/test.git fetch = +refs/heads/*:refs/remotes/origin/* [branch master] remote = origin merge = refs/heads/master My local branches: HE
git branch -a shows both remote and local branches. git branch -r shows remote branches. Is there a way to list just the local branches?
I have a local Git repository. I would like to make it available on a remote, ssh-enabled, server. How do I do this?
How do I push changes from a local git branch to an existing non-master remote branch? If I do a git push, it tries to push changes in all local branches to the remotes they are tracking.
I want to get a list of the latest commits on a certain remote Git repository. However, I do not want to create a clone because that takes too long. With SVN, I can simply pass along a username and pa
I want to track a remote master branch from a new remote repository. Both do already exist. How do I go about this in git? I can't seem to get it right. I tried: git remote add otherRepo git://... gi
I want git to forget everything that I have edited in local branch, and want to pull the update from remote branch. I did not know how to do that and I am getting merge conflicts on few files. What
I have a remote project that have a branch. So I first clone the repo. Then issue the following to the clone to work on a branch: git checkout -b <name> <remote_branch_name> Then I made t
I'm using hub to create a github repository in command, git create -d Some description But without asking me, it automatically add oldUser/repo.git as as remote, Since I'm no longer use oldUser as
I have one problem, I have been reading about that but I am not sure which solution is correct and as of now I am unable to test which solution is the right one. So, I am working on a remote branch, c
While working on a usual git repository a local branch usually tracks a corresponding remote upstream branch. This way I can easily see, whether I am ahead or behind of my upstream branch and therefor
How do I shallow clone a git repository, so that my clone contains only 1 history item, and starts on a specific branch? I know how to do a shallow clone: git clone --depth 1 https://path/to/myrepo.gi
My colleague and I are working on the same repository we've branched it into two branches each technically for different projects, but they have similarities so we'll sometimes want to commit back to
I have 3 local and 3 remote branches and want to be on the same branch on both. on local: git branch A * B master git branch -r origin/A origin/B origin/master on remote: git branch A B * master I a
What I want: Update all news commits from server with my local repository in all branch but do not merge any branch (just join the history lines). I am trying this command git fetch --force --progress
git branch -a shows me all the branches PROVIDED I already have cloned the branch. For example if I have a remote branch that I have cloned, executing this from the base dir gives me this * master rem
I try to remove the git remote branch on the bitbucket by git push command: qty:workspace qrtt1$ git push origin :my_branch remote: fatal: bad object 0000000000000000000000000000000000000000 remote: b
I have a local repository that pulls from a remote one. Running git pull as well as git fetch; git merge FETCH_HEAD used to perform exactly the same action, as is expected from the description of git
I think this is the simplest question but i am very first to the git . So can you please any body help me out. That is how to fetch the old code from the git repository and how to get the old code fro
I have a remote repository and 2 clones. I create a branch in one of the clones e.g. test. I do some work and 2 commits. I merge to master branch and push -u the branch. I do a git pull in the other c