Git is the most universally adopted version control software and is often used alongside remote repositories like GitHub and GitLab for developing, managing and distributing code.
Full Git documentation can be found here, or using
You can create a repository with either of the following commands.
||Copies a remote repository into your current directory.|
||Creates a new empty repo in your current directory.|
||Adds all python files in the current directory to the staging area.|
||Lists changes in working directory, and staged files.|
||Records everything in the staging area to your repository. The default text editor will prompt you for a commit message.|
||Records everything in the staging area to your repository with the commit message "Commit message"|
||Modify last commit instead of creating a new one. Useful for fixing small mistakes.|
||Prints commit history of repo.|
||Prints commit history of
||Removes all files from staging area. (Opposite of
By default, fetch, pull and push will operate on the origin repo. This will be the repo you cloned from, or set manually using
git branch --set-upstream-to
Running the command
git config --global credential.helper storewill store your login details next time they are entered, saving you from having to enter them again.
||Gets status of 'origin'. git fetch does not change your working directory or local repository (see
||Get status of
||Incorporates changes from 'origin' into local repo.|
||Incorporates changes from
||Incorporates changes from local repo into 'origin'.|
||Incorporates changes from local repo into
If you are working without collaborators, there should be no reason to have a conflict between your local and your remote repo. Make sure you always git pull when starting work on your local and git push when finished, this will save you wasting time resolving unnecessary merges.
At an introductory level, it is best to avoid workflows that lead to multiple branches, or requires merging.
||Create new branch
||Switch to editing branch