Git入门

Git简介

Git是一款免费、开源的分布式版本控制系统

Git安装

Windows下安装,前往https://git-for-windows.github.io/下载安装

Git配置

  • git config --global user.name "hechangzhi"
  • git config --global user.email [email protected]

初始化

  • git init

克隆仓库

git add

  • git add [文件] 此命令视目标文件状态不同,可以用来跟踪新文件,或者把已跟踪的文件放到暂存区,还可以用于合并时把有冲突的文件标记为已解决状态等

提交

  • git commit (-a) (-m)

远程仓库

查看
  • git remote (-v)
添加
  • git remote add [name] [url]
抓取数据
  • git fetch [remote-name]
  • git pull [remote-name] [branch-name]
推送数据
  • git push [remote-name] [branch-name]
重命名
  • git remote [old-name] [new-name]
删除
  • git remote rm [remote-name]

分支

创建
  • git branch [branch-name]
查看
  • git branch
切换分支
  • git checkout [branch-name]
  • git branch -b [branch-name] 相当于执行上两条命令
合并
  • git merge [branch-name]
删除
  • git branch -d [branch-name]

Eclipse的Git插件EGit

安装
  • http://download.eclipse.org/egit/updates/ 或者Eclipse Marketplace搜索EGit

你可能感兴趣的:(Git入门)