github
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
github [2019/03/15 00:35] – giovane | github [2019/03/15 13:20] (current) – [- Initializing git from a previously created local repository] pericles | ||
---|---|---|---|
Line 5: | Line 5: | ||
===== GitHub ===== | ===== GitHub ===== | ||
- | //GitHub// is an online platform where you can host and share your git repositories and projects. After git is installed in your machine, it is necessary to configure an username and an email. | + | //GitHub// is an online platform where you can host and share your git repositories and projects. After git is installed in your machine, it is necessary to configure an username and an email. |
< | < | ||
- | git configure | + | git config |
- | git configure | + | git config |
</ | </ | ||
Line 34: | Line 35: | ||
</ | </ | ||
- | For example, | + | For example, let's assume that you just tested your FEM code for the static case, however you did not finish yet the implementation of the dynamic part. Then you can use the following command: |
< | < | ||
Line 40: | Line 41: | ||
</ | </ | ||
- | This will allow you to know exactly how the code was when you commited a change. Although the local repository is being tracked by git, it is not linked with a remote repository like github for instance. We can do that by calling: | + | If you are responding to an issue (let's say, issue #1), then you can use the following command: |
+ | |||
+ | < | ||
+ | git commit -m [" | ||
+ | </ | ||
+ | |||
+ | This will allow you to know exactly how the code was when you commited a change. Although the local repository is being tracked by git, it is not linked with a remote repository like github for instance. We can do that by calling: | ||
< | < | ||
Line 46: | Line 53: | ||
</ | </ | ||
- | in which repository-location is the weblink to the remote repository, for example https:// | + | in which repository-location is the weblink to the remote repository, for example |
< | < | ||
Line 53: | Line 60: | ||
and your github username and password will be requested. | and your github username and password will be requested. | ||
+ | |||
==== - Cloning an existing remote repository ==== | ==== - Cloning an existing remote repository ==== | ||
Line 63: | Line 71: | ||
considering repository-location the source link to the remote repository you are cloning and folder is an optional argument if you want to specify the folder in your computer where the repository will be located in. | considering repository-location the source link to the remote repository you are cloning and folder is an optional argument if you want to specify the folder in your computer where the repository will be located in. | ||
+ | |||
+ | Whenever you want to check either if a file is being tracked or if there are unsaved changes, you can use the command | ||
+ | |||
+ | < | ||
+ | git status | ||
+ | </ | ||
+ | |||
+ | ==== Branches ==== | ||
+ | |||
+ | A branch indicates how the code flows. It is really helpful for co-works and when several people work simultaneously in a same code. When a new repository is created, usually it has only the branch master. To create new branches the command is | ||
+ | |||
+ | < | ||
+ | git checkout -b [branch name] | ||
+ | </ | ||
+ | |||
+ | by doing this the code flow is divided in two branches: master and a new one. Every change that you make in the new branch, the master one will remain intact. Suppose that after several changes you would like to merge the branches again. This can be performed by typing: | ||
+ | |||
+ | < | ||
+ | git merge [branch name] | ||
+ | </ | ||
+ | |||
+ | By doing that, those two branches become just the master again,and every change that were previously made in the alternative branch are transferred to master as well. | ||
Research group codes hosted on Github: | Research group codes hosted on Github: |
github.1552610152.txt.gz · Last modified: by giovane