zoukankan      html  css  js  c++  java
  • git使用

    Android开发中要学会使用git。

    Ubuntu使用git:

    在终端下载git:

    sudo apt-get install git

    首次使用需要在终端输入用户名和密码,下次使用则不需要

     第一个要配置的是你个人的用户名称和电子邮件地址。这两条配置很重要,每次 Git 提
    交时都会引用这两条信息,说明是谁提交了更新,所以会随更新内容一起被永久纳入历史记
    录:
    $ git config --global user.name "xxx"
    $ git config --global user.email xxx@xxx.com

    设置的是默认使用的文本编辑器

    $ git config --global core.editor xxx(Emacs or Vim)

    要检查已有的配置信息,可以使用 git config --list 命令

    获取帮助$ git help <verb>   $ git <verb> --help   $ man git-<verb>

    在项目文件下建一个README.md的文本里面写对项目主要功能的理解

    格式如下

    # 标题
    
    
    内容

    注意: .gitignore最好从git上 找一个最新的android.ignore复制

    然后在你想git的目录下新建一个.ignore复制进代码    代码如下

    # Built application files
    *.apk
    *.ap_
    
    # Files for the Dalvik VM
    *.dex
    
    # Java class files
    *.class
    
    # Generated files
    bin/
    gen/
    out/
    
    # Gradle files
    .gradle/
    build/
    
    # Local configuration file (sdk path, etc)
    local.properties
    
    # Proguard folder generated by Eclipse
    proguard/
    
    # Log Files
    *.log
    
    # Android Studio Navigation editor temp files
    .navigation/
    
    # Android Studio captures folder
    captures/
    
    # Intellij
    *.iml
    
    # Keystore files
    *.jks
    

    在终端输入git init设置成一个仓库,然后输入git add ./

    然后输入git commit -m “写自己给自己的提示” 这样就提交了。

    用git log查看提交时的文件,想要返回则需要git reset复制一些log上的内容即可

    检查当前文件状态 git status

    克隆: git clone +网址

    要看已经暂存起来的文件和上次提交时的快照之间的差异,可以用 git diff --cached
    命令。(Git 1.6.1 及更高版本还允许使用 git diff --staged,效果是相同的,但更好记些。)

    git远程提交到github  

      1.git remote add origin https://github的用户名:密码@从github上把地址复制下来 如:https://github.com/lishengshuai/Sunshine-Version-2.git

      2.git push -u origin master

    注:每个仓库在第一次推送,需要加-u参数,以后就不用加了

    如果git remote add....这一步弄错就需要执行git remote remove origin

    修改本地已提交的注释

    git commit --amend

    由于之前上传到github的提交和已修改的提交不一样,可以用

    git push origin master --force

    更新远程分支的本地列表

    git remote update origin --prune

    查看全文
  • 相关阅读:
    gpstop error: postmaster.pid file does not exist. is Greenplum instance already stopped
    centos7 安装企业级消息队列 RabbitMQ
    airflow入门demo
    airflow + mysql(CentOS7安装MySQL(完整版))
    Failed building wheel for psycopg2
    centos7 安装 airflow(安装 centos7、python3.6、mysql5.7、airflow)
    linux 和 windows Python pip 安装与使用, 安装包管理器 distribute
    cocos2d学习网址
    CCCallFunc CCCallFuncN CCCallFuncND的区别和使用
    CCAction详解
  • 原文地址:https://www.cnblogs.com/IT-lss/p/5360850.html
  • 最新文章
  • .net ContextBoundObject
    使用nant
    策略模式、简单工厂结合
    基本ietf文档
    windows下使用openssl生成证书
    js 位移运算
    c# socket
    log4net 使用
    以自定义的规则来对元素分组
    分离拥挤的单词
  • 热门文章
  • 查看系统正在与谁通信
    开启或关闭隐藏项目
    判断用户是否为管理员权限
    检查错误的视频文件
    启用 DHCP
    设置网络优先级
    反序操作
    Linux下文件 ~/.bashrc 和 ~/.bash_profile 和 /etc/bashrc 和 /etc/profile 的区别 | 用户登录后加载配置文件的顺序
    RabbitMQ 安装及启动报错 Error description: noproc 及 epmd error for host pg01: address (cannot connect to host/port)解决办法
    CentOS使用yum指令显示"ImportError: No module named site"错误
Copyright © 2011-2022 走看看