美文网首页
git学习笔记

git学习笔记

作者: plugin1689 | 来源:发表于2018-04-04 10:58 被阅读0次

git初始设置

git config --global user.name "username"
git config --global user.email "***@**.**"

其实这些都会更改.gitconfig文件,git命令加载时也是会查询config文件中的设置的。目前,一些常用的config命令。

[user]
  email = ***@**.com
  name = ***
[color]
  ui = auto
[alias]
  st = status
  br = branch
  co = checkout

如果写成命令格式git config --global color.ui auto
color相当于类,ui相当于color的类属性,初始化为auto。可以近似这样理解。
接下来为SSH公私钥设置,此处跳过

创建本地仓库&同步到远程仓库

这里远程仓库即是github
在github中创建仓库,例如gitRepoTest,注意这里不能勾选readme.md
因为这样goithub就会完成仓库的创建,本地仓库与远程仓库即不能同步。

第一种方式-本地库中没有初始化


不勾选readme如下所示

刷新github,即可看到远程库的代码情况,与本地相同

第二种方式-本地库已经初始化且有源文件等

使用push an existing repository from the command line即可

远程仓库更新

当本地仓库增加源文件或其他文件时,同步到github,使用git push

本地仓库更新

远程仓库更新后本地仓库的更新使用命令git pull

本地仓库分支管理

在本地仓库中使用git co -b new创建新的分支,在new分支中修改代码后,需要更新到远程库,使用git push origin new,origin告知远程仓库要先创建该分支。

相关文章

  • 学习笔记| git深入浅出 Part1_快速操作指南

    Git专题 学习笔记| git深入浅出 Part1_快速操作指南 学习笔记| git深入浅出 Part2_Git...

  • git 入门

    git 入门学习笔记----3个入门命令:git init、git add、git commit -v 学习场景(...

  • git记录

    Git Magic图解gitgit 学习笔记git游戏(学习)1、消除文档路径中文乱码git config --g...

  • Git学习笔记--常用命令整理

    超实用Git学习笔记 Git全局配置git config --global user.name "用户名"git ...

  • Git常用命令与学习总结

    安装Git Git的下载地址:Git官网下载地址 学习网址 git 学习笔记- Book 在线练习地址 基础常用指...

  • git学习笔记(二)—— git的简单操作

    这是本系列学习笔记的第二篇git 学习笔记(一)—— 初识 git 前言 本篇文章将简要的介绍 Git 的一般操作...

  • 关于crlf

    Git学习笔记:Git设置CRLF(行尾换行符) git config --global core.autocrl...

  • GIT

    Git学习笔记 Git 与 Github对接: cd到当前文档 git init初始化git git add -A...

  • Git学习笔记

    git学习笔记 声明 本文是本人学习Git过程中所做的笔记,以便日后查阅,文中多有错漏之处,不建议用作学习材料,文...

  • Git学习笔记

    git 学习笔记 注册个人信息 git config --global user.name(你的用户名) git ...

网友评论

      本文标题:git学习笔记

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