现在才开始用github托管代码真的是土爆了
在github上登录并创建好一个仓库之后 会有页面出来如何提交的指令
Create a new repository on the command line
touch README.mdgit init
git add . //很重要git add README.mdgit commit -m "first commit"git remote add origin url
git push -u origin master
Push an existing repository from the command line
git remote add origin url
git push -u origin master
还有貌似用sshkeygen工具生成公钥的指令很多啊= =
github上推送分支,在第三个url对应的博文中有提到 后来自己又摸索了一下
# Syntax: git branch# in the above is optional # if not specified the last commit will be used# If specified the corresponding commit will be usedgit branch testing# Switch to your new branchgit checkout testing# Some changes echo "Cool new feature in this branch" > test01git commit -a -m "new feature" # Switch to the master branchgit checkout master# Check that the content of test01 is the old one cat test01
进入路径然后git rm XXX
再commit和push 即可完成对某些文件或者整个工程的删除
注意是 git commit -a -m
然后就git push -u origin testing 即可
从github上拷贝分支
git clone -b
Example:
git clone -b my-branch git@github.com:user/myproject.git
Alternative (no public key setup needed):
git clone -b my-branch https://git@github.com/username/myproject.git
当需要覆盖github上的项目时
git fetch origin;
git merge origin/master
git push -u origin master 即可覆盖