Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - pushing a remote branch for a large project is really slow

Tags:

git

We're just moving to git at my work. We have a reasonably large project with some fairly large resources under version control (~500MB).

Today we tried to push a branch to a remote server and were surprised that git seemed to be trying to upload the entire project. I would have expected git to only send the deltas for the 4-5 text files that had changes (like it does for a normal push to master). Is this not how remote branches work? We used git push origin some_branch_name, is there a better command to use in this case? Should we not be storing large resources in git? If not, how do people usually handle this scenario? Is there a better way for one developer to share in-progress work with another developer w/o committing the changes to the master branch? As it stands, we're looking at around 15 min to push a remote branch, which is really not workable. What are we doing wrong?

like image 610
herbrandson Avatar asked Mar 22 '13 04:03

herbrandson


People also ask

Why is git push taking so long?

Even if you did small changes, some internal things might cause git to push a lot more data. Have a look at git gc. It cleans up your local repository and might speed up things, depending on you issue. Backup strongly advised.

How long does pushing to Github take?

Pushing with git push from the terminal takes less than 5 seconds. Actual behavior: Pushing in Atom takes several minutes.

How do I push a project to a remote branch?

In order to push a Git branch to remote, you need to execute the “git push” command and specify the remote as well as the branch name to be pushed. If you are not already on the branch that you want to push, you can execute the “git checkout” command to switch to your branch.

Does git fetch affect remote?

Fetch changes Fetched changes are stored as a remote branch, which gives you a chance to review them before you merge them with your files. Since fetch does not affect your local development environment, this is a safe way to get an update of all changes to a remote repository.


1 Answers

Can you update your post with a few things?

To get a better idea of how your project looks, please post around the top 10+ entries of the following:

git log --decorate=short --oneline --graph --all

If the large resources are binaries, then no they should not be stored in git. If those binary resources are updated then git then it has to make a complete duplicate of them internally, which the compression algorithm doesn't like, and send those up to the server. As for what to do about them, that depends on the scenario. You'll need to elaborate.

It sounds like you have several developers working on the same remote. Is this correct? If so, no developer should be committing directly to master (imho should never happen anyways). It's possible for each developer to have their own named branch. For example, developer John can create all his branches under john/<branch_name>. This will help keep the workflow clean.

Also, git doesn't work with deltas. It stores the file in its entirety each time it's changed. This may seem inefficient, but the compression used keeps size down to a minimum. And it helps checkouts and scanning log history much faster. Read the first section of Git Basics for a visualization.

like image 126
Trevor Norris Avatar answered Oct 16 '22 07:10

Trevor Norris