码迷,mamicode.com
首页 > 其他好文 > 详细

git学习

时间:2018-07-07 20:27:39      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:restore   依次   set   nbsp   ons   打开终端   内容   dev   新建库   

首先要有个git仓库地址:http://171.1.1.1

申请git账号

新建项目---按提示依次填写项目名、项目描述、可见性(一般选Private)

按着提示输入命令:

打开终端或者git bash--进入项目文件目录

Git global setup--账号密码
git config --global user.name "rita"
git config --global user.email "*****.com"
Create a new repository--新建库
git clone http://172.16.10.61/rita/my-test.git
cd my-test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder--现在的文件夹
cd existing_folder
git init  初始化
git remote add origin http://172.16.10.61/rita/my-test.git 远程添加仓库地址
git add .
git commit -m "Initial commit" 
git push -u origin master  推送到主干
Existing Git repository--现有的git存储库
cd existing_repo
git remote rename origin old-origin  远程重命名
git remote add origin http://172.16.10.61/rita/my-test.git  添加文件到git上
git push -u origin --all  推送所有的
git push -u origin --tags  推送标签

输入git 获得命令帮助:

start a working area (see also: git help tutorial)     开始一个工作区域

   clone      Clone a repository into a new directory     将存储库克隆到新目录中

   init       Create an empty Git repository or reinitialize an existing one     创建一个空的Git存储库或重新初始化一个现有的

 

work on the current change (see also: git help everyday)    研究当前的变化

   add        Add file contents to the index    向索引中添加文件内容

   mv         Move or rename a file, a directory, or a symlink   移动或重命名文件、目录或符号链接

   reset      Reset current HEAD to the specified state     将当前磁头重置为指定状态

   rm         Remove files from the working tree and from the index    从工作树和索引中删除文件

 

examine the history and state (see also: git help revisions)     检查历史和状态

   bisect     Use binary search to find the commit that introduced a bug    使用二进制搜索查找引入bug的提交

   grep       Print lines matching a pattern      打印匹配模式的行

   log        Show commit logs      显示提交日志

   show       Show various types of objects     显示各种类型的对象

   status     Show the working tree status     显示工作树状态

grow, mark and tweak your common history     成长,标记和调整你的共同历史

   branch     List, create, or delete branches

   checkout   Switch branches or restore working tree files

   commit     Record changes to the repository

   diff       Show changes between commits, commit and working tree, etc

   merge      Join two or more development histories together

   rebase     Reapply commits on top of another base tip

   tag        Create, list, delete or verify a tag object signed with GPG

 

collaborate (see also: git help workflows)

   fetch      Download objects and refs from another repository

   pull       Fetch from and integrate with another repository or a local branch

   push       Update remote refs along with associated objects

 

 

 

 

git学习

标签:restore   依次   set   nbsp   ons   打开终端   内容   dev   新建库   

原文地址:https://www.cnblogs.com/rita-0204/p/9277735.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!