git 命令

来源:互联网 发布:融资知乎 编辑:程序博客网 时间:2024/06/05 20:02
1、新建项目文件夹helloword


2、cd hellword 进入项目文件夹


3、git init 初始化仓库


4、git clone https://xxxxxx”命令


5、git status 命令用于查看项目的当前状态     加了 -s 参数,以获得简短的结果输出
  
6、git add 命令将想要快照的内容写入缓存区    git add . 全部写入缓存区


7、git commit 将缓存区内容添加到仓库中     加 -m 选项以在命令行中提供提交注释  


8、git commit -am 直接将快照的内容添加到仓库中


9、git reset HEAD --  命令用于取消已缓存的内容


10、git rm file 会将文件从缓存区和你的硬盘中移除


11、git branch (branchname)  创建分支命令


12、git checkout (branchname)  切换分支命令


13、git merge  合并分支命令


14、git branch  列出所有分支


15、git log  查看提交历史     加--oneline 查看简洁信息


16、git pull 提取远程仓库的更新


17、git remote add one https://git.coding.net/lpf123456/one.git 添加仓库关联(注:one为仓库名,默认为origin)


18、git push -u one (仓库名) master(分支名)    推送到coding.net