-
Notifications
You must be signed in to change notification settings - Fork 20
New Git page #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
New Git page #107
Conversation
:align: right | ||
|
||
.. code-block:: bash | ||
Let's say you want to develop Scilpy. Instead of cloning Scilpy directly on your computer, you should **fork** it, i.e. copy it as one of your own repositories in your own account. On Github, you can find the button *fork* on the top right of Scilpy's repository page. Then, you can clone this copy of the repository on your computer (find the link by clicking on Github's green button *Code*): :bash:`git clone INSERT_LINK_TO_YOUR_FORKED_REPOSITORY` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui bonne idée!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 months later, never too late!
# Delete a branch: | ||
git branch -d my_branch # For a local branch | ||
git push origin --delete my_branch # For a branch on origin | ||
When working in a branch other than the main one (*master* or *main*), you should often save (update) your modifications online. Each update is called a **commit**. First, to see which files have been modified without telling Git, use :bash:`git status`. Then, to add or update a file in Git's memory, use :bash:`git add my_file`. You can also add all files that have been modified and that Git already knew about, with :bash:`git add -u`. If you check again with :bash:`git status`, everything in green will be recorded with the next command: :bash:`git commit -m "Message to explain the work I have been doing in this update"`. To send these changes to the same branch name in your forked repository, use :bash:`git push origin my_branch`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we explain that a commit is not automatically backed up online, it is only a checkpoint made locally until it is pushed.
git push origin my_branch # Will automatically send it to the same branch name in your forked repo. | ||
In Git, your working directory is the local folder containing the current state of your project files. As you make changes to these files, they are tracked by Git but not yet committed (see :bash:`git status`). | ||
|
||
# From your forked repo to the upstream repo: | ||
# Use the Pull Request button on internet | ||
The staging area, also known as the index, is an intermediate space where you can organize and prepare the changes you want to include in your next commit (see :bash:`git add`). By adding changes to the staging area, you're essentially telling Git which changes should be recorded in the upcoming commit (see :bash:`git commit`). Your local repository is the hidden .git folder within your working directory, where Git stores the entire version history, including all commits and branches. It is separate from the working directory, ensuring that your project's history is preserved even if you make changes or delete files in your working directory. | ||
|
||
# From your local repo to the upstream repo: | ||
# DON'T DO THAT. Didn't you see that there is no such arrow on Figure 1! | ||
A remote repository is a version of your project stored on a remote server, allowing for collaboration with other developers. You can push your local commits (see :bash:`git push`) to the remote repository and pull changes made by others (see :bash:`git pull` or :bash:`git fetch`), keeping your project in sync across multiple environments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this should be said earlier, maybe it would fit where commits and pushes are explained.
Here is a new Git page, which is a fusion of both previous pages about Git. It is mostly the one previously found in the good practice section, but I salvaged some parts of the other Git page. Also removed the good practice section.
I would encourage building the html for this review. It wont be easy directly on Github.