Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you push every single commit? [closed]

I would like, if someone could give me more detail in working with git and remote repositories. I haven't worked with remote repositories, yet.

To the local repository you commit smaller changes that may not be too world-shattering. What is pushed to the remote repository? Every local commit? Or the overall-work that was done, which is then merged with overall-works of others? I think the log of the remote repository must be confusing, if everyone pushes every commit.

like image 943
rynd Avatar asked May 12 '12 15:05

rynd


People also ask

Do you need to push after every commit?

Typically pushing and pulling a few times a day is sufficient. Like @earlonrails said, more frequent pushes means less likelihood of conflicting changes but typically it isn't that big a deal. Think of it this way, by committing to your local repository you are basically saying "I trust this code. It is complete.

Does git push push all commits?

Default git push Then, the git push command sends all of the commits on your local main to the central repository.

What happens if I commit and dont push?

So commiting changes without pushing allow the save-load behaviour done locally during development. Once you are happy with your work, you then commit AND push.

Can I push just one commit?

If you want to push a commit without pushing previous commits, you should first use git rebase -i to re-order the commits.


1 Answers

Pushing and Pulling from the remote repository isn't quite as important as your local commits. Typically pushing and pulling a few times a day is sufficient. Like @earlonrails said, more frequent pushes means less likelihood of conflicting changes but typically it isn't that big a deal.

Think of it this way, by committing to your local repository you are basically saying "I trust this code. It is complete. It runs. I have tested it. I am ready for other people to see it." If you want to push to the remote repository after every commit, that's fine but as long as you do it on a regular basis it doesn't really matter.

Local repositories are about tracking your changes to protect the work you do. Remote repositories are for distributing the work to all your teammates and tracking everyone's changes. Your teammates need access to your code, but usually it isn't urgent and can wait until the end of the day or whenever you feel like pushing.

like image 67
acattle Avatar answered Oct 23 '22 11:10

acattle