利用 rm -rf 误删除文件夹, 恢复的办法(注意 要 提前备份或提交 其他新改变的代码, 否则执行下面的命令会让之前的新代码全部消失):
git status git reset HEAD * git checkout -- . git status
Git global setup
git config --global user.name "xxx" git config --global user.email "xxxxx.xx@ximalaya.com"
Create a new repository
git clone git@gitlab.ximalaya.com:xx-xx/test.git cd search-nlp-test touch README.md git add README.md git commit -m "add README" git push -u origin master
Existing folder or Git repository
cd existing_folder git init git remote add origin git@gitlab.ximalaya.com:xx-xxx/test.git git add . git commit -m "" git pull git@gitlab.ximalaya.com:xx-xxx/test.git git push -u origin master
git add 命令
git add -A stages All
git add . stages new and modified, without deleted
git add -u stages modified and deleted, without new
git 更新工程
rm -r target/ lib/ git add -A git commit -m "" git push -u origin master