一、git实操

1.下载路径

  • https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
  • http://windows.github.com
  • http://mac.github.com
  •  http://git-scm.com/download/linux  

2.安装步骤

  • $ git config–-global user.name ‘sansan’

  • $ git config–-global user.email ‘[email protected]

  • 生成秘钥公钥 ssh-keygen-t rsa -C '[email protected]'

  • 创建仓库(create new project at remote)
    echo "# test" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin [email protected]:Threeboys33/test.git
    git push -u origin master
    
    注:origin already exists处理
    $ vim .git/config 删除[remote "origin"]所属信息
    

3.remote版本恢复

  • $ git log --graph(查询恢复节点commite id)
     commit c490200cbb43879b4ec334ae720e9b445908654e 
  • $ git reset --hard c490200cbb43879b4ec334ae720e9b445908654e (重置本地版本)
  • $ git push -f origin master (重新更新)

4.checkout

  • $ git checkout -b dev-0201(创建新分支)
  • $ git checkout test.txt 
  • $ git commit --amend

你可能感兴趣的:(tools,java,git工具)