Create a new repository on the command line
touch README.md git init git add README.md git commit -m "first commit" git remote add origin [email protected]:JoshuaJessery/require.git git push -u origin master
Push an existing repository from the command line
git remote add origin [email protected]:JoshuaJessery/require.git git push -u origin master
- 創建分支並提交到遠程倉庫:
git branch new_branch //創建
git push origin new_branch //提交到遠程
- 刪除遠程分支上的文件:
遠程分支上的文件沒有被刪除通常是因爲刪除本地分支上的文件以後沒有提交。所以需要進行 以下操作進行遠程上的文件的刪除。
1.git rm <filename> 或者使用 git rm -rf file (刪除文件夾)
2.git commit -m 'delete' (提交到本地倉庫)
3.git push origin master (提交到遠程倉庫)
現在查看遠程分支上的文件,文件已經被刪除
- 切換分支操作:
git checkout branch 進行分支切換,然後像操作master分支一樣進行其他操作即可