初始化开始命令
git init
或者
git clone url
配置命令
git config --global color.ui true
git config --global push.default current
git config --global core.editor vim
git config --global user.name "~~"
git config --global user.email "~~@~~.com"
git config --global diff.tool meld
本地分支管理命令
// 查看本地分支列表
git branch
// 切换到branchname本地分支
git checkout branchname
// checkout当前分支到一个新分支,命名为new_branch_name
git checkout -b new_branch_name
// 将当前分支合并到branchname分支中
git merge branchname
// 查看所有 commits
git log
// 查看当前分支的状态
git status
// 添加已修改的filename文件到暂存区
git add filename
// 添加所有已修改的文件到暂存区
git add .
// Tell git not to track file anymore
git rm filename
// 将以添加在暂存区的文件提交到储存区
git commit
// 将以添加在暂存区的文件提交到储存区,并提交commit message
git commit -m "Some commit message"
// 查看当前的改变与上次commit的区别
git diff
// Compare current branch to some other branch
git diff branch_name
远程分支管理命令
// See list of remote repos available.
git remote
// 从远程仓库添加一个项目到本地
git remote add orgin url
// 将当前分支推送到远程仓库
git push
// 将当前分支推送到远程项目的master分支
git push orgin master
// 拉取远程仓库中的与本地分支不同的commit
git pull