Tag: branch

If a git pull request is still pending, how do I continue working across branches?

FYI – I’m a relative amateur with git, having used it for a couple of years but only on a very basic level. This is probably a beginner-level question. I’m collaborating on a git repo. I created a topic branch named foo, made changes, committed, pushed, and sent a pull request for my other collaborators […]

Specifying branch arguments to git fetch, merge, and push

If I am working on a branch of a repo, say devel, what is the difference between the following commands? In this case, I have already added an upstream remote: $ git fetch upstream devel From github.com:meteor/meteor * branch devel -> FETCH_HEAD and $ git fetch upstream remote: Counting objects: 500, done. remote: Compressing objects: […]

git branch restoration after merge

If I merge a git feature branch back onto master, is it best to then delete the branch? Let’s say 6 months later, I want to resurrect that deleted branch (assume a freshly cloned repo). Is there a way to easily re-create it or find its history assuming it was merged back onto master? What […]

Disconnect local branch from remote one

I have two local branches A and B tracking the same remote branch C. I want to keep all the branches but I want to remove connection A -> C but keep the connection B -> C. how can i do that?

How to have git setup tracking branch on pull

There are times when I’m pulling new changes from a repo that someone else changed. They have created new branches and pushed them to the central repo. Is there a way, when pulling these new branches, to get git to automatically create tracking branches of the same name locally?

Git Merge two repositories that are years apart with thousands of conflicts

Repository A: The old fork we’re working on now, but with hundreds of recent commits based on 3-year-old code from B. The history is long gone – it only goes back a few months when the repository was first uploaded to Github. Repository B: The new, current one we don’t have access to. Years of […]

Git pushes to too many branches

I have several branches: master, develop, feature1, feature2. I have developed some stuff in feature1 and feature2 (and pushed). Then I switched to master, done some changes and pushed: % git push To git@github.acme.com:ossmgt/myrepo.git ! [rejected] feature1 -> feature1 (non-fast-forward) ! [rejected] feature2 -> feature2 (non-fast-forward) error: failed to push some refs to ‘git@github.acme.com:ossmgt/myrepo.git’ hint: […]

How to list existing branches of a git submodule (without initializing it first)?

I have a project with lots of submodules for some specific reason. I just want to know which branches exist for each submodule. I know that I could initialize each submodule with git submodule update –init and perform a git ls-remote –heads {URL} on each submodule to get the currently existing branches of that submodule […]

Creating aliases for Git branch names

Suppose I have the following branches in git: master release-2014-11-02-some-long-text I would like to easily switch between those to, like this: git checkout devel # checkout to master git checkout release # checkout to the branch release currently points/aliases to, in this case: release-2014-11-02-some-long-text (I would like to change this alias from time to time) […]

How do you create the 'master' branch on git if you forgot to create it before branching?

Someone recently created a repo locally, branched off, and only pushed the branch to remote. Is it possible for another person to create the ‘master’ branch without any commits, and push it to the remote?

Git Baby is a git and github fan, let's start git clone.