I'm completely new to GIT, so excuse the naivety. If I'm working on a project offline, and I do multiple commits then push the changes once I'm back online, will all the commits show up in my repository, or just the last one I did before going back online?
Committing takes place only within your repository; it has nothing to do with whether or not you're online. The things that you need to be online for are pushing (publishing your commits to another repository) and pulling (fetching and merging commits from another repository).
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.
No, git push only pushes commits from current local branch to remote branch that you specified in command.
Basics. – Pushing comes after committing. Git commit records and tracks changes to the repository with each commit points to a tree object that captures the state of the repository at that moment the commit was performed, all in one complete snapshot.
Git is a distributed version control system. Your repository is entirely your own, and it contains absolutely everything you need. Committing takes place only within your repository; it has nothing to do with whether or not you're online.
The things that you need to be online for are pushing (publishing your commits to another repository) and pulling (fetching and merging commits from another repository). When you push, it will push exactly what you told it to - all of the commits on that branch. It doesn't matter when you made them or if your network cable was plugged in at the time.
All your commits will be pushed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With