Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a "stale" git branch?

Tags:

git

branch

People also ask

Should I delete stale branches?

They're unnecessary. In most cases, branches, especially branches that were related to a pull request that has since been accepted, serve no purpose. They're clutter. They don't add any significant technical overhead, but they make it more difficult for humans to work with lists of branches in the repository.

How do you get rid of stale branches?

Deleting Local Branches First, use the git branch -a command to display all branches (both local and remote). Next, you can delete the local branch, using the git branch -d command, followed by the name of the branch you want to delete.

What are stale branches in Devops?

Organize your branches The All tab lists all branches in the repo, and the Stale tab lists branches in the repo that haven't had any commits in three months or longer. If you don't see the branch you're looking for and you think it might have been deleted, see Restore a deleted branch.

How do I delete all stale branches in GitHub?

The easiest way to delete local Git branches is to use the “git branch” command with the “-d” option. The “-d” option stands for “–delete” and it can be used whenever the branch you want to clean up is completely merged with your upstream branch. $ git branch -d release Deleted branch feature (was bd6903f).


The oldest reference to "stale" is found in commit e194cd1 (Jan. 2007, Git 1.5.0), which detected "stale tracking branches in remote": when tracking a branch which was removed by the remote system.
Hence git remote prune.

That is the main definition for stale branch: a remote tracking branch (a local reference of a remote repo branch) which no longer tracks anything (because the actual branch on the remote repo is gone).

git remote show is able to list those.


Incidentally, you have two other definitions of "stale" in the Git system:

  • Another reference to "stale" involves git reflog --stale-fix in commit 1389d9d (Git 1.5.0), for tracking "broken commit": a commit that is not reachable from any of the refs and there is a missing object among the commit, tree, or blob objects reachable from it that is not reachable from any of the refs.
    That helps fixing situation after running non reflog-aware git prune from an older git in the presence of reflogs.

  • Commit 740fdd2 (March 2008, Git 1.5.5) also introduces "stale" for symbolic refs, when the ref they point to no longer exists.


As mentioned by @SteelToe: The definition of a stale branch, as per GitHub documentation, is a branch that has not had any commits in the previous 3 months.
This generally indicates an old/unmaintained/not current branch.


The definition of a stale branch, as per GitHub documentation, is a branch that has not had any commits in the previous 3 months.

This generally indicates an old/unmaintained/not current branch.

For more information see https://help.github.com/articles/viewing-branches-in-your-repository/


That's because there is no "exact definition". "Stale git branch", "stale data", "stale configuration options" -- none of these have an exact definition, but they all refer to things that are considered old/unmaintained/not current/possibly broken.

So a "stale git branch" is generally a branch of the repository that hasn't been touched in a long time. Maybe it's broken, maybe not; it's certainly not current w/r/t to the active development branch, and nobody has looked at it for a while.


Stale branch is a branch without activity after some time. In Github it's stale after 3 months of inactivity.

Reasons, why projects have stale branches: unreleased features, prototype, alternative solution, incomplete, incompatible.

read more