git 常用命令 git ssh 密钥如何生成

简介: git 常用命令 git ssh 密钥如何生成

如何生成密钥



git ssh

git clone

git add --all

git commit -m 'up'

git ssh 生成。在企业中如果企业中的运维要,那你就给这个pub 文件就对了

git config --global user.name ""

git config --global user.email "你自己的邮箱"

ssh-keygen -t rsa -C "你自己的邮箱"

id_rsa.pub 密钥文件


每天如何操作git 一般习惯是什么样的,一个模块或一个页面或一个功能为单位

git add git commit 多次添加多次提交。 而git Push 或pull 一般为早晨 和中午 或下班前 提交,这个操作意味着你要提到远程仓库,让别人看到,让是不管电脑坏不坏,公司仓库代码是有的。


中间如果要上线,或别人需要,那push 也是可以的,其他就不要频繁操作,那样别人会不断的更新。


以下是一下常用的命令。分享一下


git 有github 这个是开源的,个人的项目可以被别人看见的,公司的项目一定不能公开放上去,要有法律责任的


bitbucket.org coding gitee 等这些都是做私有仓库的。还有就是自己搭建一下,其实也挺方便的。本地文件上传线上 git仓库


没有文件夹

mkdir myproname

cd myproname


已存在文件夹

cd mypro name


初始化

git init


添加

git add --all


提交

git commit -m '提交'


remote

git remote add origin https://git.coding.net/xxx/ke.xxx.com.git


提交

git push -u origin master

git pull --rebase origin master


GIT 常用命令:



$ cd E:转到e盘
$ ls查看此处目录
$ cd fe/转到fe文件夹
git 常用命令
 1、git clone命令——用于克隆项目git库,git clone git@库地址:库名
    例如 git clone git@172.16.33.3:testcrm
 2、git branch命令,用于操作分支
    git branch 分支名 //添加本地分支
    例如 git branch feature 添加feature分支
    git branch -d 分支名 //删除本地分支
    例如 git branch -d feature 删除feature分支
    git branch -a 查看本地分支和远程库的分支
3、git checkout feature //切换分支
4、git pull origin feature 从远程拉取分支与当前分支合并
5、git fetch origin feature:feature 从远程分支feature分支拉取到本地命名为feature
6、git merge -no-ff -m "text" feature 将feature分支合并到当前分支下(所处的分支)
7、git tag 添加标签
   git tag testscrm-develop-201505081353 库名-分支名-年月日时分
8、git push origin feature 将feature分支推送到服务器
   git push origin tags 将标签推送到服务器
9、git status 查看更改的文件
10、git add 更改的文件名
    例如 git add html/index.html 添加更改的index.html(按查看结果的路径走)
11、 git commit -m "备注"  //添加备注并提交
     git rm file url    -r
12、git checkout –b branch hotfix
案例1,本地无testcrm库时,需要将testcrm库中的feature分支合并到develop分支
一、获取仓库
 在F盘中选择git bash,进入操作
 git clone git@172.16.33.3:testcrm 克隆项目库
 cd testcrm 进入新增目录
 git branch -a 查看本地分支和远程库的分支
二、切换分支
 git checkout develop 切换到develop分支
三、拉取分支
 git fetch origin feature:feature 拉取feature分支
四、合并feature分支到develop分支,将feature分支合并到develop分支下,处于develop分支下
 git merge –no-ff –m “merge 201509071552” feature  合并feature分支到develop分支
(git merge --no-ff -m "merge 201509081552" feature)
 git log 查看提交记录
五、添加标签
 git tag testcrm-develop-201509071558 // 库名+分支名+添加标签的时间(年月日时分)
六、推送分支到服务器
 git push origin develop
七、推送标签到服务器
 git push origin --tags
案例2,本地有testcrm分支,需要将develop与feature分支合并
一、更新testcrm目录,右键git bash 进入git命令
 git checkout develop 切换到develop分支
 git pull origin develop 更新develop分支
二、更新feature分支
 git fetch origin feature:feature (或者切换到feature分支下,执行 git pull origin feature)
三、合并分支,将feature分支合并到develop分支下,处于develop分支
 git merge -no-ff -m "merge 201509071552" feature
 git log 查看提交记录
四、添加标签
 git tag testcrm-develop-201509071558 //项目库名-分支名-添加标签的时间(年月日时分)
五、推送分支到服务器
 git push origin develop
六、推送标签到服务器
 git push origin tags


相关文章
|
7天前
|
缓存 数据可视化 网络安全
Git命令大全
Git命令大全
40 1
|
11天前
|
开发工具 git
Git教程:深入了解删除分支的命令
【4月更文挑战第3天】
36 0
Git教程:深入了解删除分支的命令
|
29天前
|
存储 Shell Linux
【Shell 命令集合 文件管理】Linux git命令使用教程
【Shell 命令集合 文件管理】Linux git命令使用教程
33 0
|
29天前
|
开发工具 git
git常用命令整理
git常用命令整理
13 0
|
17天前
|
开发工具 git 开发者
Git常用命令大全:让你轻松驾驭版本控制
Git命令速查:`git init`新建仓库,`git clone`克隆,`git add`入暂存区,`git commit -m`提交,`git status`查看状态,`git log`查看历史,`git branch`创建分支,`git checkout`切换,`git merge`合并,`git pull`拉取更新,`git push`推送,`git remote -v`查看远程,`git checkout --`撤销本地修改,`git reset HEAD`取消暂存,`git reset --hard`回退版本。掌握这些,提升代码管理效率!
16 0
|
24天前
|
算法 开发工具 git
【git 实用指南】git 增加 本地代码 git add 相关命令和复杂情况需求
【git 实用指南】git 增加 本地代码 git add 相关命令和复杂情况需求
90 0
|
28天前
|
Shell Linux 开发工具
【Shell 命令集合 系统管理 】Linux 查看当前Git仓库的提交历史 gitps命令 使用指南
【Shell 命令集合 系统管理 】Linux 查看当前Git仓库的提交历史 gitps命令 使用指南
14 0
|
1月前
|
开发工具 git
git命令使用大全
git命令使用大全
20 1
|
1月前
|
开发工具 git
|
1月前
|
存储 安全 网络安全
Git 安全远程访问:SSH 密钥对生成、添加和连接步骤解析
SSH(Secure Shell)是一种用于安全远程访问的协议,它提供了加密通信和身份验证机制。在使用 SSH 连接到远程 Git 存储库时,您可以使用 SSH 密钥对来确保安全性。以下是关于如何生成和使用 SSH 密钥对的详细步骤: 生成 SSH 密钥对
98 2