Git is a system for distributed version control designed to enable the public or private development of software. Code in Git is primarily hosted on a central repository such as GitHub, Bitbucket, or a self-hosted option such as GitLab. Local copies can be cloned from the main online repositories.
As a developer, you can edit your own local copy as much as you want. Once you’re happy with your changes though, you may want to push your changes to the online repository. Pushing your customisations allows everyone to benefit from your contributions and for the community to continue to iterate on them.
How to push updates
The command to push your updates is just “git push”, however, before you run that command there are some other things you need to do first. Before you can push your changes, you first need to configure which changed file or files you want to push by adding them to the staging area. You can add files to the staging area with the “git add” command.
Tip: All of the commands to push updates must be run via the terminal from within the git project’s directory.
When adding files, you can specify them individually such as “git add [filename]” or you can use wildcards, such as “git add *.txt” to add all txt files.
Either before or after you add the files, it is good practice to check to see if you’ve missed any edited files. You can do this with the “git status” command. The “git status” command will show which files have changes staged for commit and which do not.
Tip: When you add a file, it doesn’t actually add the entire file, simply the changes made to that file. This means if you make changes to a file after adding it, you will need to add it again. This means a file can show up in both the staged changes and un-staged changes lists.