美文网首页
GIT 常用命令随笔

GIT 常用命令随笔

作者: 将行陌路 | 来源:发表于2018-01-11 16:13 被阅读17次

常用git 命令

#新建分支
git checkout -b iss53
#删除本地分支
git branch -D iss53

#新建标签  
git tag -a v1.1.4 -m "tagging version 1.1.4"  
#删除本地仓库标签  
git tag -d v1.1.4 

#tag推送到本地和远程
1.push单个tag,命令格式为:git push origin [tagname]
#例如:
git push origin v1.0 #将本地v1.0的tag/branch推送到远端服务器
#2.push所有tag,命令格式为:git push [origin] --tags

#删除远程分支
$ git push origin --delete <branchName>
#删除tag这么用:
$ git push origin --delete tag <tagname>

git 代码回滚

先显示提交的log
$ git log -3
commit 4dc08bb8996a6ee02f
Author: Mark <xxx@xx.com>
Date:   Wed Sep 7 08:08:53 2016 +0800

    xxxxx

commit 9cac9ba76574da2167
Author: xxx<xx@qq.com>
Date:   Tue Sep 6 22:18:59 2016 +0800

    improved the requst

commit e377f60e28c8b84158
Author: xxx<xxx@qq.com>
Date:   Tue Sep 6 14:42:44 2016 +0800

    changed the password from empty to max123
回滚到指定的版本
git reset --hard e377f60e28c8b84158
强制提交
git push -f origin master

git 新建项目

git init
git add README.md
git commit -m "first commit"
git remote add origin xxx.git
git push -u origin master
git 修改密码后重置本地信息 弹出输出密码弹框
#设置用户名密码
git config --global user.name "xxx"
git config --global user.email "xxx@yeah.net"
#重置
git config --system --unset credential.helper
#缓存上 不用每次都输入密码
git config --global credential.helper store
ssh配置
cd ~/.ssh
ssh-keygen -t rsa -C "your_email@example.com"

#添加你的 SSH key 到 github/gitlab上面去
 clip < ~/.ssh/id_rsa.pub             (windows)
 pbcopy < ~/.ssh/id_rsa.pub       (mac)

添加到ssh-agent
ssh-add ~/.ssh/id_rsa 
ssh-add ~/.ssh/id_rsa_github

相关文章

  • git 常用命令

    前言 Android 常用命令集,只做随笔,会不断更新 解决方案 初始化命令git init 提交命令git ad...

  • git相关教程汇总

    1. git常用命令 git常用命令总结git常用命令讲解 2. git教程相关网站 廖雪峰的git教程猴子都能懂...

  • git命令整理

    git常用命令 GIT常用命令备忘:http://stormzhang.com/git/2014/01/27/gi...

  • git操作

    Git原理 Git常用命令

  • Git 常用命令及应用这一篇就够了(新手向)

    1. git 常用命令 1.1 常用命令 1.2 git remote 管理远程仓库 1.3 git r...

  • Git 常用操作

    常用命令图: 常用命令 查看本地、远端、全部分支 git branch git branch -r git bra...

  • Git 常用命令详解

    @[TOC](Git 常用命令详解) 1. Git 常用命令 1.1 常用git 命令图表汇总 1.2 配置个人信...

  • git 命令

    Git常用命令总结Git常用命令总结 git init 在本地新建一个repo,进入一个项目目录,执行git ...

  • 实习日记2:git代码管理

    mac:brew install git创建 常用命令:git常用命令及详解[https://blog.csdn....

  • Git与Github的使用总结 - day 03

    git常用命令总结 git配置(config): git仓库(repository): git分支(branch)...

网友评论

      本文标题:GIT 常用命令随笔

      本文链接:https://www.haomeiwen.com/subject/cwctoxtx.html