or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Introduction to Git –- Fall 2020
Lecture 6: Working with remotes
Slides: https://hackmd.io/@hpc2n-git-2020/L6-remotes#/
Basic concepts
A remote repository is a version of the project which can be hosted in your local machine, some network, or over the internet[1] where you and your collaborators can push or pull code modifications.
In addition to this, a remote is a way to backup your repository.
Basic concepts cont.
The command
displays the remotes that are already set up where you can fetch and pull changes. In this case there is only a single remoted called origin.
Adding remotes
A remote repository can be added manually with the command
where the location of the remote can be an URL or the path if that is in your local machine.
Protocols:
Why do we need more than one remote?
Working with remotes
One can push or fetch/pull to or from remotes by
In case you obtained the repository by cloning an existing one you will have the origin remote. You can do push/fetch/pull for this remote with
or
because the remote origin and the master branch are configured for pushing and pulling by default upon cloning.
The command:
brings all the changes (branches) that are in the remote and tries to merge them with your local repo. The default behavior of git pull is in the $GIT_DIR/config file:
In fact, git pull is a combination of two commands:
The command
will send all the changes (branches) to the remote by default. This can be changed by applying:
Displaying remote information
Renaming remotes
Deleting remotes
Bare repositories
A bare repository is a repository with no working directory.
Creating a bare repository
Cloning a bare repository cont.
Using GitHub
Upon login into your GitHub account you will see the following option to create a new repository
Here, you can choose the type of repository that is appropriate to your needs (public/private), if you want to add README and .gitignore files and also the type of license for your project,
GitHub will suggest some steps that you can take for your brand-new repository:
Setting ssh-keys
Network visualization
Pull requests
In the following scenario, a developer, Bob, has its repo on GitHub. Another developer, Alice, finds it useful and forks it. After doing some changes, Alice push them and do a "pull request"
Then, Bob receives an email with the pull request information about Alice modifications. On the GitHub site he sees the request:

Because Bob find the changes from Alice useful and there are no conflicts he can merge them straight away,

Issues
If you find some issues in the files/code you can open an "Issue" on GitHub

You may also assign people to the issues that are more related to that topic.
In future commits you may refer to this issue by using the issue number, #2 in this case. This will allow you to track the evolution of the issue on GitHub.
Best practices