Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PUSH all local GIT branches? Best Practice?

Tags:

git

push

workflow

Should ALL locally created GIT branches be pushed to the central-repository on a daily basis? What is best-pracice workflow concerning this?

We created a GIT repository to manage our large e-commerce site, which is under continual development by a large team.

The central repository is at 'Beanstalk' and we have three primary branches, 'prestaging' (master), 'staging' and 'production'. All development should be merged into prestaging when it is completed locally and ready to be published.

I can see pushing long-running branches to Beanstalk as well. However some of our team advocates pushing ALL local development branches to Beanstalk on a daily basis in-progress or not; to create redundancy. I think this would clutter the repository with hundreds of branches over time. What is best practice?

like image 556
Garrick Avatar asked May 10 '12 15:05

Garrick


People also ask

How do I push all branches at once?

To push the all branches to a remote git, we can use the git push command followed by the --all flag and origin. This will create a track with the local branches to the remote branches.

Does git push push all local branches?

Push all of your local branches to the specified remote. Tags are not automatically pushed when you push a branch or use the --all option. The --tags flag sends all of your local tags to the remote repository.

Is it good practice to 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.


1 Answers

I prefer not polluting the central repo with all branches of all users.

Don't mix:

  • publication workflow: what you choose to publish (push/pull to an upstream repo)
  • backup need: use a bundle (See "Backup a Local Git Repository"), that way you have only one file to copy to any remote drive you want.
like image 133
VonC Avatar answered Oct 19 '22 03:10

VonC