侯祥胡的自我成长学习记录网络空间--Git/R/Linux/Sublime Text/Data Science/Web Tech(HTML/CSS/Javascript/SQL/Python)--github webpage
侯祥胡的Github 个人空间,分享一些计算机与程序设计方面的学习感悟。
Hello github,This is 侯祥胡的Git Pages link.
This is Back to Xiangxing98 Github Profile inline link.
This is Data camp inline link.
echo "# learn-centos" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/xiangxing98/learn-centos.git
git push -u origin master
#SSH
echo "# learn-centos" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:xiangxing98/learn-centos.git
git push -u origin master
git clone git@github.com:xiangxing98/learn-centos.git learn-centos
git add .
git commit -m "comment here about what you
Configure remotes,When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from.
To keep track of the original repo, you need to add another remote named upstream:
cd Spoon-Knife
# Changes the active directory in the prompt to the newly cloned "Spoon-Knife" directory
git remote -v
# 首先要先确定一下是否建立了主repo的远程源
git remote add upstream https://github.com/octocat/Spoon-Knife.git
# Assigns the original repo to a remote called "upstream"
# 如果里面只能看到你自己的两个源(fetch 和 push),那就需要添加主repo的源,git remote add upstream URL
git remote -v
# 再次确定一下是否建立了主repo的远程源,现在你就能看到upstream了,like:
# origin git@github.com:cobish/fork-demo.git (fetch)
# origin git@github.com:cobish/fork-demo.git (push)
# upstream https://github.com/wabish/fork-demo.git (fetch)
# upstream https://github.com/wabish/fork-demo.git (push)
Pull in (Fetch then merge) upstream changes. If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:
git fetch upstream
# Fetches any new changes from the original repo. Pulls in changes not present in your local repository, without modifying your files. 使用 fetch 命令更新,fetch 后会被存储在一个本地分支 upstream/master 上。
git merge upstream/master
# Merges any changes fetched into your working files,合并到本地分支。切换到 master 分支,合并 upstream/master 分支。
git push origin master
Updated @ 2019-07-06
Updated @ 2021-09-26