Reputation: 3193
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?
Upvotes: 72
Views: 50901
Reputation: 652
Git is a distributed version control system, meaning your local copy of the code is a complete version control repository. These fully-functional local repositories make it is easy to work offline or remotely. You commit your work locally, and then sync your copy of the repository with the copy on the server.
When you commit offline it will store that info in the local directory and when you connect to the internet and push your local repo, all your commits will sync to online GitHub directory.
The good thing about this is that your commit will be shown on Contribution activity graph with same time and date when you committed them offline.
Upvotes: 7
Reputation: 566
all commits will get pushed and everyone that also uses your repo will also see all the individual commits that you pushed and work with them as they would normally
Upvotes: 32
Reputation: 497152
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.
Upvotes: 73