http://www.open-open.com/lib/view/open1414396787325.html
https://www.visualstudio.com/en-us/docs/git/gitquickstart#clone
http://www.yiibai.com/git/git_push.html
从远程获取最新版本到本地:
--git fetch origin master
git pull origin master
把远程下载下来的文件合并到本地仓库
git merge origin/master
@echo off
D:
cd MMFeed
cd MMFeedHealthyDatacache
cd GitResporsitory
cd VideoIGData
REM git clone https://msasg.visualstudio.com/DefaultCollection/Bing_UX/_git/VideoIGData //克隆(第一次获取最新)
git pull https://msasg.visualstudio.com/DefaultCollection/Bing_UX/_git/VideoIGData Manifest_BWInt_Test //获取分支<pre name="code" class="csharp">Manifest_BWInt_Test上的最新版本
@pause
忽略本地某个文件的未被提交的修改:(即撤销修改),有三种方法:
1. 回退到上一个版本:(见下面:将本地文件回退到之前的版本:)
2.手动修改文件内容知道与上一个版本内容相同,在add到暂存区,最后commit到Git
3.D:\GitRepository\VideoIGData\Feed\manifest_BWInt>git checkout 120sports.com_inc_150724/manifest.xml
提交本地某个文件到Git:
D:\GitRepository\VideoIGData\Feed\manifest_BWInt>git add 120sports.com_inc_150724/manifest.xml //先添加到暂存区
<pre name="code" class="csharp">D:\GitRepository\VideoIGData\Feed\manifest_BWInt>git commit -m '提交的comments' //将该文件提交到Git仓储VideoIGData
查看当前所在分支:
git status
查看本地文件和Git上文件内容的区别:
<pre name="code" class="csharp">D:\GitRepository\VideoIGData\Feed\manifest_BWInt>git diff 120sports.com_inc_150724/manifest.xml
查看历史记录:从最近到最远的日志
<pre name="code" class="csharp">D:\GitRepository\VideoIGData\Feed\manifest_BWInt>git log
将本地文件回退到之前的版本:
<pre name="code" class="csharp">D:\GitRepository\VideoIGData>git reset --hard HEAD^ //回退到上一个版本
<pre name="code" class="csharp"><pre name="code" class="csharp">D:\GitRepository\VideoIGData>git reset --hard HEAD~100 //回退到前一百个版本
查看版本号:
git reflog
删除某个文件:
<pre name="code" class="csharp">D:\GitRepository\VideoIGData\Feed\manifest_BWInt>git rm 120sports.com_inc_150724/manifest.xml
然后再commit,
如果还没commit,则可以恢复被删的文件:
git checkout --120sports.com_inc_150724/manifest.xml
创建分支并切换
git checkout -b newBranch //创建了newBranch分支,并切换到了该分支
git branch newBranch // 指创建分支newBranch
git checkout newBranch //切换分支
查看当前的分支:
git branch //列出了所有分支, 并标亮当前分支