Tag: git branch

How to determine when a Git branch was created?

Is there a way to determine when a Git branch was created? I have a branch in my repo and and I don’t remember creating it and thought maybe seeing the creation timestamp would jog my memory.

What are the differences between local branch, local tracking branch, remote branch and remote tracking branch?

I just started using Git and I got really confused between different branches. Can anyone help me to figure out what the following branch types are? local branches local tracking branches remote branches remote tracking branches What is the difference between them? And how do they work with each other? A quick demo code will […]

Git fetch remote branch

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 the *master from the branch. However, I have the branch, how can my colleague pull that branch specifically. A git clone of […]

Where does a Git branch start and what is its length?

Every now and then I’m asked, on what commit a certain branch on git starts or if a certain commit has been created on a specific branch. The end point of a branch is pretty clear: that’s where the branch label sits. But – where did it start? The trivial answer would be: on that […]

How to create a new empty branch for a new project

We are using a git repository to store our project. We have our branches departing from the original branch. But now we want to create a small new project to track some documentation. For that we would want to create a new empty branch to start storing our files, and I would want other users […]

Move branch pointer to different commit without checkout

To move the branch pointer of a checked out branch, one can use the git reset –hard command. But how to move the branch pointer of a not-checked out branch to point at a different commit (keeping all other stuff like tracked remote branch)?

Remove local branches no longer on remote

Is there a simple way to delete all local branches which do not have a remote equivalent? Example: Branches (local and remote) master origin/master origin/bug-fix-a origin/bug-fix-b origin/bug-fix-c Locally, I only have a master branch. Now I need to work on bug-fix-a, so I check it out, work on it, and push changes to the remote. […]

Is there a way to lock a branch in GIT

I have an idea of locking a repository from users pushing files into it by having a lock script in the GIT update hook since the push can only recognize the userid as arguments and not the branches. So i can lock the entire repo which is just locking a directory. Is there a way […]

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. […]

Is there a better way to find out if a local git branch exists?

I am using the following command to find out if a local git branch with branch-name exists in my repository. Is this correct? Is there a better way? Please note that I am doing this inside a script. For this reason I’d like to stay away from porcelain commands if possible. git show-ref –verify –quiet […]

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