Command line instructions
HTTPS
Git global setupgit config --global user.name "taohong.ouyang"git config --global user.email "taohong.ouyang@husor.com"Create a new repositorygit clone http://git.husor.com/beibei_qa/trade-search-service-test.gitcd trade-search-service-testtouch README.mdgit add README.mdgit commit -m "add README"git push -u origin masterExisting foldercd existing_foldergit initgit remote add origin http://git.husor.com/beibei_qa/trade-search-service-test.gitgit add .git commitgit push -u origin masterExisting Git repositorycd existing_repogit remote add origin http://git.husor.com/beibei_qa/trade-search-service-test.gitgit push -u origin --allgit push -u origin --tags
Git global setupgit config --global user.name "taohong.ouyang"git config --global user.email "taohong.ouyang@husor.com"Create a new repositorygit clone git@git.husor.com:beibei_qa/trade-search-service-test.gitcd trade-search-service-testtouch README.mdgit add README.mdgit commit -m "add README"git push -u origin masterExisting foldercd existing_foldergit initgit remote add origin git@git.husor.com:beibei_qa/trade-search-service-test.gitgit add .git commitgit push -u origin masterExisting Git repositorycd existing_repogit remote add origin git@git.husor.com:beibei_qa/trade-search-service-test.gitgit push -u origin --allgit push -u origin --tags
本地分支已经建立,与远程分支联系。
** 删除与远程分支的关联** git remote rm origin
回退版本
git reset –hard:彻底回退到某个版本,本地的源码也会变为上一个版本的内容
git reset HEAD^ //回退所有内容到上一个版本git reset HEAD^ a.py //回退a.py这个文件的版本到上一个版本git reset –soft HEAD~3 //向前回退到第3个版本git reset –hard origin/master //将本地的状态回退到和远程的一样git reset 057d //回退到某个版本git revert HEAD //回退到上一次提交的状态,按照某一次的commit完全反向的进行一次commit
丢弃 本地所有的改动。 git fetch --all
git reset --hard origin/master
git fetch 只是下载远程的库的内容,不做任何的合并 git reset 把HEAD指向刚刚下载的最新的版本