zoukankan      html  css  js  c++  java
  • win7系统git学习笔记(一)

    git仓库里的文件只有两种状态,一种是已跟踪(tracked),一种是未跟踪(untracked)。已跟踪的文件中又分为未更新(unmodified),已修改(modified),已放入暂存区(staged)。

    常用命令:

    初始化仓库:

    $ git init

     fork:

    $ git clone git://github.com/schacon/grit.git
    $ git clone git://github.com/schacon/grit.git  新的文件名

    检查文件状态:

    $ git status

    创建新的文件

    $ touch 文件名

    跟踪新文件(放入暂存区)/在修改文件后,把文件加入暂存区

    $ git add 文件名

    commit(快照)文件并对这次的修改进行说明。

    $ git commit -m '说明信息'

     push你的commit

    $ git remote add 名字(对这次的push命名) http://github.com/username/要push的文件名
    $ git push -f 名字 master 

    删除工作目录中的文件(不在暂存区)/删除git仓库中的文件(在暂存区):

    $ git rm 文件名
    $ git rm -f 文件名

    删除git仓库中的文件(暂存区文件)

    $ git rm --cached 文件名

    常见错误:

     $ git remote add practise https://github.com/shangshicc/GitPractise

    错误提示:fatal: remote practise already exists.

    解决办法:$ git remote rm practise.

    参考资料:pro git Github官网帮助的翻译 git常见错误解决方案

  • 相关阅读:
    编程语言学哪个比较好?
    C#一定要避免程序中很多的依靠
    EXPIREAT
    EXISTS
    DUMP
    Python之sys模块
    Python的OS模块
    CentOS 7上安装gitlab-runner
    PyCharm激活方法
    Linux03 文件的相关操作(touch、rm、mv、cat)
  • 原文地址:https://www.cnblogs.com/shangshicc/p/4029726.html
Copyright © 2011-2022 走看看