X龙@China .Net 'blog

需要的不仅仅是工作,而是通过努力得来的美好将来。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

github项目管理

Posted on 2012-09-03 12:14  X龙  阅读(1180)  评论(0编辑  收藏  举报

 

软件环境:windows, githubGit Shell

(使用github当文件比较多的时候会很耗系统资源)

1.    新建项目 

github.com新建repository

(

 使用Git Shell将本地的repository上传到GitHub.com:(所有操作在Git Shell中执行)

  1. 在本地创建repository,使用cd命令定位到你的项目文件夹(例:c:\projects\MyRepo

  2. 运行git init,会在目录下生成".git"隐藏文件夹。

  3. 将项目下的所有文件添加到git中,运行“git add .”(不要“”.表示将目录下所有文件添加到git中)。

  4. 运行git commit -m "提交备注"

  5. 运行git remote add origin https://github.com/(你的库),连接到github.com上你的repository

  6. 运行git push origin master,文件就会同步到github.com

)

 

2.    向现有添加项目文件并提交

a. 可再次运行git add .添加文件到git中,即使有些文件已经存在。

b. 运行git commit –m “提交说明提交更改。

c. 运行 git push origin master提交至github.com

 

3.       撤消更改

a.         git revert HEAD                  撤销前一次 commit

b.         git revert HEAD^               撤销前前一次 commit

c.         git revert commit (比如:fa042ce57ebbe5bb9c8db709f719cec2c58ee7ff)撤销指定的版本,撤销也会作为一次提交进行保存。

     d.     恢复某个已修改的文件(撤销未提交的修改):git checkout file-name

*         最后运行 git push origin master提交至github.com

 

4.      删除文件

    a. git rm myfile.txt。

    b. git commit -m ""。

    c. git push origin master。 

 

 


 参考:

http://www.cnblogs.com/fnng/archive/2011/08/25/2153807.html

http://hi.baidu.com/mcspring/item/198f1e977f8f98bccd80e5b3

http://blog.microsuncn.com/?p=1559

 

 

 

点击这里给我发消息http://wp.qq.com/index.html