取得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. iOS 更改导航栏返回button文字

    假如有两个ViewController A,B 改动B的返回button需在A页面设置 self.navigationItem.backBarButtonItem = [[UIBarButtonIte ...

  2. HDOJ2031进制转换

    项目做久了,我发现自己对代码的实现能力越来越差劲了!经过前一段时间找工作的经历就能够明显感觉的到自己的代码熟练度不够!因此,今后要多加练习.要想做好一个优秀的程序猿就要多写程序,多思考. ★结题思路 ...

  3. Ubuntu切换至root用户

    第一种方式: 使用命令 sudo passwd root 设置root用户的密码 然后su root即可切换至root用户  第二种方式: sudo bash

  4. Matlab中K-means聚类算法的使用(K-均值聚类)

    K-means聚类算法采用的是将N*P的矩阵X划分为K个类,使得类内对象之间的距离最大,而类之间的距离最小. 使用方法:Idx=Kmeans(X,K)[Idx,C]=Kmeans(X,K) [Idx, ...

  5. Windows Server 中开启 SQL Server 2008 的1433端口

    在Windows Server2008 服务器上部署了Microsofit SQL Server2008 R2 ,想让远程机器能够访问,于是开放1433端口,进行了如下设置: 1.打开“本地安全策略” ...

  6. linq中的GroupBy总结

    1.简单形式: var q = from p in db.Products group p by p.CategoryID into g select g; 语句描述:Linq使用Group By按C ...

  7. 选项卡 js操作

    html代码展示(这里展示的是关于日程的标签页)css样式这里省略了>>>>自己写的可能更好看 <div class="row"> <ul ...

  8. USACO Section 4.2 The Perfect Stall(二分图匹配)

    二分图的最大匹配.我是用最大流求解.加个源点s和汇点t:s和每只cow.每个stall和t 连一条容量为1有向边,每只cow和stall(that the cow is willing to prod ...

  9. C++学习之引用

    C++学习之引用         临时变量.引用参数和const         现在,当参数为const引用的时候,如果实参与引用参数不匹配,C++将生成临时变量.C++将在下面两种情况下生成临时变 ...

  10. Mysql 批量杀死进程

    正常情况下kill id,即可,但是有时候某一异常连接特别多的时候如此操作会让人抓狂,下面记录下小方法: use information_schema; select concat('kill ',i ...