GIT Commit vs. Push


Perhaps you've longed for a chance to go back in time and correct a blunder you committed. Unfortunately, time travel isn't possible -- except for software developers. Version control software like Git keep track of all the changes made over the lifetime of your programming project. Git lets you perform an electronic version of a "do over."

Git Overview

  • Git is a free, open-source distributed version control software utility written by Linus Torvalds, the creator of the Linux operating system kernel. Git works without the need for a single central software repository. Each developer can work on his own complete copy of a Git repository stored on his own computer. You can even work on your local repository copy without Internet access. You can collaborate with other developers by merging your changes with their Git repository copies or with a central server repository used by all developers.

Git Work Flow

  • You install the latest version of a project's Git repository on your computer by issuing a Git "pull" command. The pull command downloads a complete copy of the repository source code you can view, compile, test, debug and make changes to. Once you've completed your changes, your files are added to a temporary staging area and held there until they're ready to be officially merged with your local copy of the repository. Once this is done, you can merge your changes with the project's repository.

Git Commit

  • Maintaining the integrity of your work by controlling what goes into and out of your repository is an important job of any version control system. The changes you make to one or more files don't become part of the repository until you first issue a "commit" command. This command prompts you to enter brief comments listing the changes you made. Once committed, your file is part of your local branch of the repository, but is not yet merged with the main branch.

Git Push

  • Before others can use your code, you must add it to the main branch. The "push" command transfers the changes you committed to your local branch to the remote, main repository. The push command "git pull origin master" automatically sends your local repository changes to the remote repository you pulled your branch from originally. You can undo the changes you pushed by using the "git-revert" command.


  • Photo Credit Brand X Pictures/Brand X Pictures/Getty Images
Promoted By Zergnet



Related Searches

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!