Git 简单使用

1、打开Git bash

编辑git配置文件配置拉取URL:

git config -e

git pull origin:master

克隆yaml到git仓库:

git clone http://name:password@ip:port/platform/yaml.git Git_repository

git clone http://name:password@ip:port/platform/yaml-template.git

git pull

git add .

git commit -m "ottyaml"

git push

切换分支

git checkout stable

git pull (更新成stable最新)

git checkout master

git pull (更新成master最新)

创建仓库
git init

创建分支

git branch test: 基于当前commit创建test分支。.git/HEAD 文件中记录了当前分支名字。
删除分支

git branch -d test:删除本地test分支

git branch -D test: test分支还没有合入当前分支,所以要用-D参数才能删掉。

git push origin --delete test 删除远程test分支

git push origin :test 删除远程test分支

查看分支

git branch 列出当前分支清单

git branch -a 查看远程分支和本地分支

git branch -v 查看各个分支最后一个提交信息

git branch --merged 查看哪些分支已经合并入当前分支

拉取分支

git fetch origin 同步远程服务器的数据到本地

git checkout -b test origin/test_remote 将远程分支test_remote拉取下来到本地test分支

git checkout test 将远程分支test拉取下来到本地test分支

git pull test 从远程分支test 中checkout下来的本地分支test成为跟踪分支,使用git pull或者git push就会操作到对应的远程分支test

posted @ 2020-12-03 11:31  Jzm笔记  阅读(79)  评论(0编辑  收藏  举报