zoukankan      html  css  js  c++  java
  • git

    一. 常用命令

    • 设置全局用户名和邮箱
    git config --global user.name "waterystone"
    git config --global user.email "waterystone@xx.com"
    git config -l 

    • 创建库
    1)进入目录,清理不必要的文件
    2)git init
    3)git add .
    4)git commit -a -m "comments"
    5)git push git@github.XXX.com:waterystone/test.git master
    ok!
    然后eclipse重新从git拉到本地。

    • 提交
    1)清理
    2)git add .
    3)git commit -a -m "test"
    4)git push

    • 查看状态
    git status
    git diff 查看修改哪些
    git log 查看提交的版本历史记录

    • 标签
    显示当前标签:git tag
    git tag v1.0.0.1 建立轻量级标签
    git push origin --tags 提交


    • ignore
    如果文件已经track到git中,则再ignore无效。
    解决方案:
    1)启动git bash
    2)#rm -r xxx(如果是target,则需要关闭eclipse,以避免动态生成)
    3)#git commit -a -m "xxx"
    4)#git push
    ok

    • stash
    git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。
    git stash pop: 从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。
    git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
    git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。


    • branch
    git branch myBranch 添加分支
    git branch 显示所有分支
    git checkout -b myBranch 新建一个分支并切换过去
    git checkout myBranch 切换分支


    • github.com项目
    )创建
    #git init
    #git add .
    #git commit -m "first commit"
    #git remote add origin https://github.com/waterystone/mongodb-test.git
    #git push -u origin master

    2)拉取
    #git remote add origin https://github.com/waterystone/mongodb-test.git
    #git push -u origin master

  • 相关阅读:
    查看jvm的cg情况
    什么是json
    httpclient工具类
    mysql 优化思路(1)
    mysql存取日期出问题
    springboot和tomcat jar包冲突
    递归
    如何去理解return?
    js BOM判断当前窗口是否最顶层。
    个人笔记,关于ajax 如果没有请求成功不允许再次请求的方法。
  • 原文地址:https://www.cnblogs.com/waterystone/p/5085289.html
Copyright © 2011-2022 走看看