git终端操作

2017-09-19  本文已影响130人  伍帆

git终端使用

第一次使用git看这里

删除远程仓库的方法

克隆远程仓库到本地库:git clone http文件
对需要删除的文件:git rm test.txt (删除文件)
文件夹:git rm -r test/ (删除文件夹)
提交修改:git commit -m "提交信息"
将修改提交到远程仓库:git push

退出vim和node以及其他模式


使用:q或者Ctr+C

fork别人的项目更新主页方法

git fetch upstream master
git merge upstream/master
git push

出现过的问题

git fetch upstream master
fatal: 'upstream' does not appear to be a git repository fatal: Could not read from remote repository.


$ git merge upstream/master
Updating 48477c5..67e6709
error: Your local changes to the following files would be overwritten by merge:
homework/.DS_Store
Please commit your changes or stash them before you merge.
Aborting


$ git merge upstream/master
Updating e842e43..dbf103a
error: Your local changes to the following files would be overwritten by merge:
webapp/src/public/stylesheets/style.css
webapp/src/views/_head.ejs
webapp/src/views/index.ejs
webapp/src/views/sayToTeacher.ejs
Please commit your changes or stash them before you merge.
Aborting


$ git merge upstream/master
error: The following untracked working tree files would be overwritten by merge:
homework/.DS_Store
Please move or remove them before you merge.
Aborting


How to ignore error on git pull about my local changes would be overwritten by merge?>Your local changes to the following files would be overwritten by merge
What if I want to overwrite them?
I've tried things like git pull -f, but nothing works.
To be clear, I only want to overwrite specific changes, not everything.


上一篇 下一篇

猜你喜欢

热点阅读