git在windows上的安装和简单使用

时间:2023-11-26 11:08:20

git在windows上的安装和简单使用。

参考:

https://git-scm.com/book/zh/v1/Git-%E5%9F%BA%E7%A1%80-%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E7%9A%84%E4%BD%BF%E7%94%A8

http://blog.csdn.net/mengdc/article/details/76566049

http://blog.csdn.net/fengser/article/details/50532274

http://blog.csdn.net/lygttpod/article/details/46473291

开始:

git可以在这里下载:,安装过程默认就可以了,

(之前有远程仓库)安装之后选择一个指定的本地址文件夹,右键git base,输入:

  $ git init

  $ git config --global user.name "Your Name"

  $ git config --global user.email "email@example.com"

  ($ ssh-keygen -t rsa -C “xxx@163.com” 这个之前忘记用过没,现在换了电脑,没使用目前是可以的,详细参考这里:http://blog.csdn.net/lygttpod/article/details/46473291)

下载远程仓库代码:

$ git clone git://github.com/molyjao/mlims.git(git:// 固定,后面为仓库地址,这个是我的在git上的仓库,只是一些基本关于springboot和springcloud的使用~~)

进入下载的文件夹:

$ cd 分支名/文件名

查看远程

$ git remote

代码提交:

$ git add . (添加所有修改的代码到版本控制,也可以使用命令git add <file>,注意,可反复多次使用,添加多个文件;eg: git add readme.txt)

$ git commit -m "注释"  //如果显示 git commit -c"xxx"   如果提示:fatal: could not lookup commit xxx, 先使用git commit,然后在vim中添加注释就可以了,

$ git push ...(远程仓库地址)

git在windows上的安装和简单使用

git在windows上的安装和简单使用

至此提交成功,还有其它的操作的命令很多很多,常用命令可以在这里学习

删除远程代码:

git rm --cache file 删除缓存中文件,误提交可以使用这个,

git rm --f file 删除远程仓库文件