Tag: branch

git: Switch branch and ignore any changes without committing

I was working on a git branch and was ready to commit my changes, so I made a commit with a useful commit message. I then absentmindedly made minor changes to the code that are not worth keeping. I now want to change branches, but git gives me, error: You have local changes to “X”; […]

git fetch doesn't fetch all branches

I have cloned a repository, after which somebody else has created a new branch, which I’d like to start working on. I read the manual, and it seems dead straight easy. Strangely it’s not working, and all the posts I’ve found suggest I’m doing the right thing. So I’ll subject myself to the lambasting, because […]

How to commit my current changes to a different branch in git

This question already has an answer here: How to merge my local uncommitted changes into another Git branch? 6 answers

Git: Merge to master while automatically choosing to overwrite master files with branch

I am using Git to track my documentation latex source. I want to keep the master branch full of documents that are suitable for end user release, so when someone needs something, i can just switch to the master branch, compile and hand out the document. I make new branches when a manual needs a […]

Pull all commits from a branch, push specified commits to another

I have the following branches: master production and the following remote branches: origin/master origin/production I have a script that fetches the origin/master branch and gets the diff of what changed from my last fetch (log -p master..origin/master). Then I merge origin/master. The commits found are pushed to a code review tool. I want to push […]

Git branch strategy for small dev team

We have a web app that we update and release almost daily. We use git as our VCS, and our current branching strategy is very simple and broken: we have a master branch and we check changes that we ‘feel good about’ into it. This works, but only until we check in a breaking change. […]

Git commits are duplicated in the same branch after doing a rebase

I understand the scenario presented in Pro Git about the risks of git rebase. The author basically tells you how to avoid duplicated commits: Do not rebase commits that you have pushed to a public repository. I am going to tell you my particular situation because I think it does not exactly fit the Pro […]

How to merge my local uncommitted changes into another Git branch?

How can I do this in git: My current branch is branch1 and I have made some local changes. However I now realize that I actually meant to be applying these changes to branch2. Is there a way to apply/merge these changes so that they become local changes on branch2 without committing them on branch1?

Is git-svn dcommit after merging in git dangerous?

My motivation for trying out git–svn is the effortless merging and branching. Then I noticed that man git-svn(1) says: Running git-merge or git-pull is NOT recommended on a branch you plan to dcommit from. Subversion does not represent merges in any reasonable or useful fashion; so users using Subversion cannot see any merges you’ve made. […]

How do you remove an invalid remote branch reference from Git?

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 remotes/public/master error: branch ‘remotes/public/master’ not found. Also, the output of git remote is strange, since it does not list public: $ git remote show origin […]

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