zoukankan      html  css  js  c++  java
  • new bird in github

    首次使用先要建立本地github信息:

    git config - -global user.name  newbird

    git config - -global user.email   newbird@mail.com

    ssh-keygen -t rsa -C newbird@mail.com

    //该命令将会在~/.ssh/下生成公钥id_rsa.pub

    //打开该文件,将公钥复制到github用户主页中的“SSH and GPG keys”的New SSH key中

    //打开主页中所需要要同步的repostory,选择“clone and download”选择“clone with ssh”

    //将生成的ssh key复制,并在shell中执行git "ssh key you copyed",这时便将repository同步到本地了

    修改本地repository并push到主页:

    先在本地建立仓库:

    git init     //如果是建立新仓库

    git stash  //把自己写的代码先保存到一边,这时候代码会恢复你改之前的版本

    git pull    //提交代码之前一定先要pull,再将自己修改的部分add以及commit,否则可能会出来冲突。如果出现冲突根据英文提示一步步排除冲突即可。

    git stash pop  //把之前git stash保存的代码再与拉下来的代码合并,这时候可能会产生冲突,冲突的代码在文件中会出现========的符号,将其调整并删除即可。

    git add filename  //filename可省

    git commit  -m  “ xxxxxx”    //默认添加一个master branch    

      git branch new_branch  //添加一个新的branch名为“new_branch”

      git branch -a //查看当前所有分支

      git checkout new_branch  //记得切换前commit一下,否则可能丢失你之前编辑的内容 

      如果需要回复到之前的版本: git reset --hard  harsh_code

        但注意:reset version之后可能会推不上去代码,这时候用 git push -f 来推

      git merge new_bracn   //将new_branch合并到当前分支

      git rm -r xxxdir  //将之前git add进repo的文件夹删除,但要注意该命令会将文件系统中的文件也相应删除,相当于也用了rm -r xxdir命令。只要还没有push都可以用此命令删除,一但push进remote就不能彻底删除了

    链接主页:

    先在主页创建一个你需要的repo,再复制其ssh链接

    git remote add repo ssh@url 

    git push -u repo your_branch_name

    **注意**:repo尽量自己起名字

  • 相关阅读:
    设置zookeeper开机自启动
    安装zookeeper
    Elasticsearch 5.6.5 安装head插件
    [redis] Node is not empty. Either the node already knows other nodes
    【redis】 redis 创建集群时,Waiting for the cluster to join.... 一直等待
    [redis] redis.clients.jedis.exceptions.JedisDataException: MOVED 13102 127.0.0.1
    [linux] FastDFS访问文件,400 Bad Request
    [linux] Nginx编译安装错误error: the HTTP rewrite module requires the PCRE library
    [java] java解析txt文件
    【java】 java 解压tar.gz读取内容
  • 原文地址:https://www.cnblogs.com/fariver/p/6188611.html
Copyright © 2011-2022 走看看