Git常用命令

发布日期:2019年11月13日    浏览次数:523

git clone 仓库地址

git add . //添加文件到仓库

git commit -m '提交注释' //本次提交文件的原因

git remote add origin 远程仓库地址

git push origin master //提交代码推送到远程仓库,最后是分支的名字

git pull origin dev //拉取代码到当前分支,最后是其它分支名字

git status //查看当前操作状态

git pull //拉取远程仓库的文件

git checkout 分支名 //切换到某个分支上

git branch // 查看本地分支

git branch -a  //查看所有分支

git branch -r  //查看远端分支

git branch  分支号 //切换本地分支

git checkout -b 分支号 //本地创建新分支

git push origin local_branch:remote_branch // 将本地分支推送到远端

git branch -d local_branch //删除本地分支

git branch -r -d origin/branch-name //删除远端分支

git checkout -b localbranch origin/remotebranch  //从远端拉取分支,并命名为本地分支


  • 提交新评论