Git: Difference between revisions

36 bytes added ,  9 days ago
m
no edit summary
[unchecked revision][unchecked revision]
m (Replace external links with interwiki)
mNo edit summary
 
Line 20:
Firstly, cloning a repository, which is basically downloading a remote repository to your own machine. To do so, run the following command in your terminal:<syntaxhighlight lang="bash">
git clone [URL of repository]
</syntaxhighlight>To push updates made from a local machine to a remote repository, there are three commands needed. You must be in the directory of the project to run these. Firstly, you must stage all changes made to the repository:<syntaxhighlight lang="bash">
git add .
</syntaxhighlight>Now, you can make a commit message, which is a short single-line comment on the changes made. Often repositories will have a specific structure for commit messages that you must adhere to. To do so, run:<syntaxhighlight lang="bash">
git commit -m "[COMMIT MESSAGE]"
</syntaxhighlight>Finally, push the updates to the remote repository:<syntaxhighlight lang="bash">
git push
</syntaxhighlight>Note that these instructions expect that you created the repository. There will be additional steps such as forking the repository and making a pull request when you are contributing to somebody else's repository. This also expects that you are pushing to the main branch.