Git: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
m Replace external links with interwiki |
mNo edit summary |
||
Line 20: | 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"> |
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] |
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> |
</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 . |
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> |
</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]" |
git commit -m "[COMMIT MESSAGE]" |
||
</syntaxhighlight>Finally, push the updates to the remote repository:<syntaxhighlight> |
</syntaxhighlight>Finally, push the updates to the remote repository:<syntaxhighlight lang="bash"> |
||
git push |
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. |
</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. |