Git常用命令

初始化开始命令

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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值