我看到一个例子,使用命令“git remote add {name} {URL of github repository}”。这个正确吗?我要用我的本地仓库替换{name}字段吗?
非常感谢任何建议。
我是Github的新手,不想破坏我的本地仓库,希望有经验的人能提供一些建议。
谢谢。
Add the remote repository (I've called it upstream
here, you could call it everything):
git remote add upstream {URL of github repository}
Fetch all the commits, branches, tags, etc. from the upstream
remote repo. This is a safe command and does not destroy your local repo's history or your working-tree.
git fetch upstream
You could run git log upstream/BRANCH_NAME
or git log upstream/TAG_NAME
to see the list of commits for the given BRANCH_NAME
or TAG_NAME
on the remote upstream
. In fact for any of the git commands, if you want to refer to the branch present in the remote upstream
, use the upstream/<BRANCH_NAME>
syntax. For tags, tags/TAG_NAME
should suffice.
If you want to merge or rebase changes from these tags or branches into your local repo, you could do so using the merge
and rebase
commands. Let me know if you need more help on these commands.
是的,那是正确的。
git remote add upstream git://github.com/antirez/redis.git
name
部分只是一个你选择的名称,以便于引用。
Adds a remote named <name> for the repository at <url>. The command
git fetch <name> can then be used to create and update
remote-tracking branches <name>/<branch>.
git merge tags/FOO
。 - Tuxdude