美文网首页
git 使用记录

git 使用记录

作者: 王国的荣耀 | 来源:发表于2020-07-29 17:46 被阅读0次

    sourcetree

    mac sourcetree连接github,报错:fatal:Authentication failed for'https://git…。或提示password required 解决方案

    sourceTree 注册跳过

    defaults write com.torusknot.SourceTreeNotMAS completedWelcomeWizardVersion 3

    git 使用

    1. 先进入项目文件夹通过命令 git init 把这个目录变成git可以管理的仓库 git init
    2. 把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点“.”,意为添加文件夹下的所有文件。git add .
    3. 用命令 git commit告诉Git,把文件提交到仓库。引号内为提交说明
      git commit -m 'message'

    git 修改密码,提交失败

    git config --global credential.helper osxkeychain
    然后再执行 git push 等命令时就会提示输入用户名和密码了

    git archive

    问题: 如果你用过svn,一定知道svn export,可以用来从代码库中导出一份干净的代码(没有.svn等)。git是否有类似功能呢?

    git archieve 可以用于将库中代码打包。
    基本用法:
    git archive --format tar.gz --output "./output.tar.gz" master

    git commit 提交

    git commit -am "add file"

    git checkout

    撤销对文件的修改
    git checkout ./path

    git remote -v

    git remote -v 查看当前目录的git远端地址

    origin  https://github.com/miguelgrinberg/flasky.git (fetch)
    origin  https://github.com/miguelgrinberg/flasky.git (push)
    

    git tag -l -n

    git tag 查看当前的tag列表
    1."tag" 部分
    tag 代表的是标签动作,可以带参数 ,也可以不带参数,
    带上不同的参数可以实现标签的 新建/删除/查询/验证 等功能.

    2."-l" 部分
    -l 注意是字母"L",以列表形式列出所有tag的版本号.

    3."-n" 部分
    -n 显示出每个版本号对应的附加说明.

    ✗ git tag -l -n 
    10a             Chapter 10: User profiles (10a)
    10b             Chapter 10: Profiles editor (10b)
    10c             Chapter 10: User avatars (10c)
    10d             Chapter 10: Caching of user avatar hashes (10d)
    11a             Chapter 11: Blog posts (11a)
    11b             Chapter 11: Blog posts in profile pages (11b)
    11c             Chapter 11: Generate fake users and posts (11c)
    11d             Chapter 11: Blog post pagination (11d)
    11e             Chapter 11: Rich text blog posts with Flask-PageDown (11e)
    11f             Chapter 11: Rich text server side handling with Markdown and Bleach (11f)
    11g             Chapter 11: Permanent links to posts (11g)
    11h             Chapter 11: Blog post editor (11h)
    12a             Chapter 12: Database representaton of followers (12a)
    12b             Chapter 12: Followers in the application (12b)
    12c             Chapter 12: Followed posts with a join (12c)
    12d             Chapter 12: Show followed blog posts in home page (12d)
    12e             Chapter 12: Self-followers (12e)
    13a             Chapter 13: Blog post comments (13a)
    13b             Chapter 13: Comment moderation (13b)
    14a             Chapter 14: API (14a)
    15a             Chapter 15: Coverage metrics (15a)
    15b             Chapter 15: Unit tests with the Flask test client (15b)
    15c             Chapter 15: API testing with the Flask test client (15c)
    15d             Chapter 15: Unit tests with Selenium (15d)
    16a             Chapter 16: Logging of slow database queries (16a)
    16b             Chapter 16: Source code profiling (16b)
    17a             Chapter 17: Deploy command (17a)
    17b             Chapter 17: Email notification of application errors (17b)
    17c             Chapter 17: Heroku support with Gunicorn (17c)
    17c-waitress    Chapter 17: Heroku support with Waitress (17c-waitress)
    17d             Chapter 17: Docker support (17d)
    17e             Chapter 17: MySQL support for Docker (17e)
    17f             Chapter 17: Docker Compose support (17f)
    17g             Chapter 17: Traditional hosting (17g)
    1a              Chapter 1: initial version (1a)
    2a              Chapter 2: A complete application (2a)
    2b              Chapter 2: Dynamic routes (2b)
    2c              Chapter 2: Command line options with Flask-Script (2c)
    3a              Chapter 3: Templates (3a)
    3b              Chapter 3: Templates with Flask-Bootstrap (3b)
    3c              Chapter 3: Custom error pages (3c)
    3d              Chapter 3: Static files (3d)
    3e              Chapter 3: Dates and times with Flask-Moment (3e)
    4a              Chapter 4: Web forms with Flask-WTF (4a)
    4b              Chapter 4: Redirects and user sessions (4b)
    4c              Chapter 4: Message flashing (4c)
    5a              Chapter 5: Database models with Flask-SQLAlchemy (5a)
    5b              Chapter 5: Database use in the application (5b)
    5c              Chapter 5: Shell context (5c)
    5d              Chapter 5: Database migrations with Flask-Migrate (5d)
    6a              Chapter 6: Email support with Flask-Mail (6a)
    6b              Chapter 6: Asynchronous emails (6b)
    7a              Chapter 7: Large file structure (7a)
    8a              Chapter 8: Password hashing with Werkzeug (8a)
    8b              Chapter 8: Authentication blueprint (8b)
    8c              Chapter 8: Login and logout with Flask-Login (8c)
    8d              Chapter 8: User registration (8d)
    8e              Chapter 8: Account confirmation (8e)
    8f              Chapter 8: Password updates (8f)
    8g              Chapter 8: Password resets (8g)
    8h              Chapter 8: Email address changes (8h)
    9a              Chapter 9: User roles and permissions (9a)
    
    

    git checkout

    更新到指定版本的tag

    git checkout 4a
    

    #GIT 重置并更新到最新

    git reset --hard HEAD
    git clean -f -d
    git checkout master
    git fetch origin master
    git reset --hard origin/master
    git pull
    
    

    git archive

    问题: 如果你用过svn,一定知道svn export,可以用来从代码库中导出一份干净的代码(没有.svn等)。git是否有类似功能呢?

    git archieve 可以用于将库中代码打包。
    基本用法:
    git archive --format tar.gz --output "./output.tar.gz" master
    说明:

    git config

    查看系统config
    git config --system --list

    查看当前用户(global)配置
    git config --global --list

    查看当前仓库配置信息
    git config --local --list

    查看user.name
    git config user.name

    查看user.email
    git config user.email

    相关文章

      网友评论

          本文标题:git 使用记录

          本文链接:https://www.haomeiwen.com/subject/mwrkrktx.html