zoukankan      html  css  js  c++  java
  • idea中使用git更新代码(十三)

    前言

    记录idea使用git更新并提交代码遇到的一点疑惑。

    一、更新

    因为不太了解using stash与using shelve的区别,所以百度了一下。我自己一直用的using stash。

    有两种方式,如下:

    1.1 直接pull

    这就是 git pull。相当于git fetch+git merge

     1.2 通过update project 按钮

     就是这种方式有点疑惑。

    标号1容易理解,直接选择从默认分支更新即可。

    标号2的含义查了下,如下:

    两个命令都是把代码搁置,只是stash是git原生的。shelve是idea独有的。

    1. shelve存在当前项目下.idea/shelve里
    2. 查看shelve,打开version control面板,点开shelf
    3. unshelve,在面板里选择你需要unshelve的条目即可
    git shelve doesn't exist in Git.
    
    Only git stash:
    
    when you want to record the current state of the working directory and the index, but want to go back to a clean working directory.
    which saves your local modifications away and reverts the working directory to match the HEAD commit.
    You had a 2008 old project git shelve to isolate modifications in a branch, but that wouldn't be very useful nowadays.
    
    As documented in Intellij IDEA shelve dialog, the feature "shelving and unshelving" is not linked to a VCS (Version Control System tool) but to the IDE itself, to temporarily storing pending changes you have not committed yet in changelist.
    
    Note that since Git 2.13 (Q2 2017), you now can stash individual files too.

    git中不存在git shelve。

    只有git储备:

    当您希望记录工作目录和索引的当前状态,但又希望返回到一个干净的工作目录时。

    它保存您的本地修改并恢复工作目录以匹配HEAD提交。

    您有一个2008年的老项目git shelve来隔离分支中的修改,但这在现在不是很有用。

    正如Intellij IDEA搁置对话框中所记载的那样,特性“搁置和解除搁置”并没有链接到VCS(版本控制系统工具),而是链接到IDE本身,用来临时存储尚未提交的挂起的更改。

    注意,自从Git 2.13(2017年第二季度)以来,你现在也可以隐藏单独的文件了。

    嫌不够详细,可以去官网地址再查看!

    其实直接用using stash就行了。

    我平常就是直接用这个,要是报错了,就自己手动的执行1,然后再git pull,再执行2,手动合并冲突。就是相当于先git stash,将本地变更存储起来,然后再从远程仓库更新代码git pull到本地仓库及编码区,再执行2,手动merge下冲突。

    别出现下面这位老哥的错误就行了:

    二、提交

    idea添加push按钮到工具栏:

    如果错过太阳时你流了泪,那你也要错过群星了。
    在所有的矛盾中,要优先解决主要矛盾,其他矛盾也就迎刃而解。
    不要做个笨蛋,为失去的郁郁寡欢,聪明的人,已经找到了解决问题的办法,或正在寻找。
  • 相关阅读:
    就这样吧
    搞了个1.0版本,名字和预定的一样改成OIFaQ了
    算了,总结一下教训
    我刚经历了人生中第一次版本回滚,目前感觉良好,请党和人民放心
    这有点爽的
    我决定出1.0的时候改名叫OIFaQ
    换个SSD把D盘弄飞了
    算是交代一下这三天的空白
    构建之法读书笔记03
    构建之法读书笔记02
  • 原文地址:https://www.cnblogs.com/szrs/p/15409907.html
Copyright © 2011-2022 走看看