取得Git仓库

初始化一个版本仓库

git init

Clone远程版本库

git clone git@xbc.me:wordpress.git

添加远程版本库origin,语法为 git remote add [shortname] [url]

git remote add origin git@xbc.me:wordpress.git

查看远程仓库

git remote -v 

提交你的修改

添加当前修改的文件到暂存区

git add .

如果你自动追踪文件,包括你已经手动删除的,状态为Deleted的文件

git add -u

提交你的修改

git commit –m "你的注释"

推送你的更新到远程服务器,语法为 git push [远程名] [本地分支]:[远程分支]

git push origin master

查看文件状态

git status

跟踪新的 .cs 和 .csproj 文件

git add *.cs
git add *.csproj

从当前跟踪列表移除文件,并完全删除

git rm readme.txt 

仅在暂存区删除,保留文件在当前目录,不再跟踪

git rm –cached readme.txt 

重命名文件

git mv reademe.txt readme 

查看提交的历史记录

git log 

修改最后一次提交注释的,利用–amend参数

git commit --amend 

忘记提交某些修改,下面的三条命令只会得到一个提交。

git commit –m "add readme.txt"

git add readme_forgotten

git commit –amend

假设你已经使用git add .,将修改过的文件a、b加到暂存区

现在你只想提交a文件,不想提交b文件,应该这样

git reset HEAD b

取消对文件的修改

git checkout –- readme.txt

基本的分支管理

创建一个分支

git branch iss53 

切换 工作目录到iss53

git chekcout iss53 

将上面的命令合在一起, 创建 iss53分支并切换到iss53

git chekcout –b iss53 

合并master,当前工作目录为iss53

git merge master

合并iss53分支,当前工作目录为master

git merge iss53 

合并完成后,没有出现冲突,删除iss53分支

git branch –d iss53 

拉去远程仓库的数据,语法为 git fetch [remote-name]

git fetch 

fetch 会拉去最新的远程仓库数据,但不会自动到当前目录下,要自动合并

git pull 

查看远程仓库的信息

git remote show origin 

建立本地的dev分支追踪远程仓库的develop分支

git checkout –b dev origin/develop 

打开git ui

gtik

参考资料

远程仓库的使用

何谓分支

基本的分支与合并

分支的管理

分支式工作流程

远程分支

衍合

Git Command Summary (Updated)的更多相关文章

  1. git: command not found

    在使用git时,出现“git: command not found”的情况,于是使用yum安装: [root@localhost ~]# yum install -y gitLoaded plugin ...

  2. 警告: git command could not be found. Please create an alias or add it to yo

    5 Answers active answertab=oldest#tab-top" title="Answers in the order they were provided& ...

  3. Git Command之Code Review

    原文链接 准备 Step 1. Create a team and add a teammate Step 2. Create a repository with some content 应用 Cl ...

  4. [Tool] SourceTree初始化GitFlow遇到错误(git command not found)的解决方案

    [Tool] SourceTree初始化GitFlow遇到错误(git command not found)的解决方案 问题情景 使用SourceTree,可以方便开发人员快速的套用GitFlow开发 ...

  5. keil l251 command summary --Lib

    keil l251 command summaryLIB251 LIST MYLIB.LIB TO MYLIB.LST PUBLICS LIB251 EXTRACT MYLIB.LIB (GOODCO ...

  6. Cordova 3.0 Plugin 安装 及"git" command line tool is not installed

    根据http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface Windows命令行 ...

  7. [Practical Git] Navigate git command pager output with Unix less commands

    When using a git command that can have a large amount of output (like git log, git diff, or git blam ...

  8. git command

    下载github代码 git clone https://github.com/zhoug2020/2015.git 在github上创建仓库: Create a new repository on ...

  9. git command line 提交代码

    echo "# spring-boot-apollo-demo" >> README.md git init git add README.md git commit ...

随机推荐

  1. 按模板打印word防止并发操作

    /// <summary> /// /// <summary> /// 打印人员备案表 /// </summary> /// <param name=&quo ...

  2. activity的打开关闭动画

    Activity的打开关闭或者说相互跳转之间可以设置动画的.默认的打开关闭直接消失或出现,比较不优美,但是有的手机Rom对这个默认做了修改,比如红米HM1,默认的就是新页面自右向左滑动出现,自左向右滑 ...

  3. matlab GUI之常用对话框(四)-- 输入对话框 inputdlg、目录对话框 uigetdir、列表对话框 listdlg

    常用对话框(四) 1.输入对话框  inputdlg answer = inputdlg(prompt) answer = inputdlg(prompt,dlg_title) answer = in ...

  4. 2014.8.16 if语句

    语句 if语句 大体可以分一下几种: 小知识  生成一个随机数: Random sss = new Random(); int a = sss.Next(100); Console.WriteLine ...

  5. ubuntu菜单面板丢了怎么找回

    我的ubuntu菜单面板丢了.   我的ubuntu用的是gnome桌面环境,桌面环境分为三个区域: 1.菜单面板 (1)三个主菜单:应用程序,位置,系统. (2)快速启动区:菜单面板中间的部分称为快 ...

  6. mysql save or update

    原文:http://www.bitscn.com/pdb/mysql/201503/473268.html 背景   在平常的开发中,经常碰到这种更新数据的场景:先判断某一数据在库表中是否存在,存在则 ...

  7. C++类的常成员函数

    让一个成员函数带上常量性是什么意思呢?通常的答案是,一个常成员函数不会更改其class对象.这是一种平凡的表述,而编译器实现的手法也相当平凡. 任何非静态成员函数其实都被编译器隐式插入了一个指针类型的 ...

  8. HBase ElasticSearch

    http://www.open-open.com/doc/view/c2af706064f84e128d0f74826523a1ea http://www.open-open.com/doc/view ...

  9. Weblogic安装NodeManager

    http://blog.sina.com.cn/s/blog_6ed936400100ytdo.html

  10. 再探Delphi2010 Class的构造和析构顺序

    发了上一篇博客.盒子上有朋友认为Class的构造和析构延迟加载.是在Unit的初始化后调用的Class的构造.在Unit的反初始化前调用的Class的析构函数. 为了证明一下我又做了个试验 unit ...