标签:stage 工作 epo roo nothing hang led 设置 ini
前记:
一、创建本地仓库,在/d/Projects/git目录下创建仓库。
Administrator@WIN-20151122RYN MINGW64 /d/Projects/git $ git init Initialized empty Git repository in D:/Projects/git/.git/
二、新建index.php,并在index.php中:
<?php
echo "hello git";
三、提交到本地仓库
Administrator@WIN-20151122RYN MINGW64 /d/Projects/git (master) $ git add ./ Administrator@WIN-20151122RYN MINGW64 /d/Projects/git (master) $ git status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: index.php Administrator@WIN-20151122RYN MINGW64 /d/Projects/git (master) $ git commit -m "make a file named index.php" [master (root-commit) 4ccd708] make a file named index.php 1 file changed, 2 insertions(+) create mode 100644 index.php Administrator@WIN-20151122RYN MINGW64 /d/Projects/git (master) $ git status On branch master nothing to commit, working tree clean
(注:git add ./ 将当前目录(/d/Projects/git)发生变化的文件添加到仓库的暂存区)
四、提交本地项目到远程服务器:
1、为远程服务器项目添加别名:
git remote add git_origin git@xxx.xx.xxx.xx:/data/gitserver/git.git ##根据实际情况设置
git remote rm git_origin ##删除
2、推送项目:
git push git_origin master ##将本地的 master 分支推送至远端的 master 分支,如果没有就建一个
(注:遇到错误:
remote: error: insufficient permission for adding an object to repository database objects remote: fatal: failed to write object error: remote unpack failed: unpack-objects abnormal exit是因为远程的git.git文件没有访问权限,在git.git目录下:chown -R git:git git.git
)
五、从远程服务器clone项目到本地
在E:/git目录下
Administrator@WIN-20151122RYN MINGW64 /e/git
git clone git@xxx.xx.xxx.xx:/data/gitsrv/git.git
六、从服务器同步代码到本地
Administrator@WIN-20151122RYN MINGW64 /d/Projects/git (master)
$ git pull git_origin master
七:日志
Administrator@WIN-20151122RYN MINGW64 /d/Projects/git (master)
$ git log
或
Administrator@WIN-20151122RYN MINGW64 /d/Projects/git (master)
$ git log --pretty=oneline
八、版本切换
git reset --hard 2580d ##2580d是某个版本号前几位,只要不重复就行
标签:stage 工作 epo roo nothing hang led 设置 ini
原文地址:http://www.cnblogs.com/lippor/p/6885010.html