zoukankan      html  css  js  c++  java
  • Git skills in reseting files

    How to uncommit files that were committed long time a ago?
    Note: Since all changes in the current working directory are very important, they should not be affected!

    1. Reset the repository into a committed state, but does not affect the current working directory and index(staging) tree.
    git reset --soft [commit - hash]

    2. Unstage all changed files
    git reset HEAD --

    3. Add the file you want to commit
    git add [filename]

    4. Add the changes into repos
    git commit -m "something"

    Useful command:
    git log | grep Jingwei -B 5

    How to reset a file into the state of a certain commit?
    git checkout [commit - hash] [filename]
    Note: the checkout here is quite confusing. it it requires - _ -

    Open a new code review

    git stash && git pull --rebase && git stash pop
    post-review

    Useful links:
    http://git-scm.com/docs/git-reset

    The theory of git rest:
    http://www.tigraine.at/2010/09/15/git-unstaging-all-changes-and-reset-the-working-tree

    The display lines for grep command
    http://stackoverflow.com/questions/9081/grep-a-file-but-show-several-surrounding-lines

  • 相关阅读:
    codevs 1450 xth 的旅行
    Loj #6287 诗歌
    Codeforces 323C Two permutations
    Spoj MKTHNUM
    [TJOI2015]弦论
    Spoj SUBLEX
    bzoj 4338: BJOI2015 糖果
    bzoj 3462: DZY Loves Math II
    bzoj 2843: 极地旅行社
    清北学堂模拟赛d4t5 b
  • 原文地址:https://www.cnblogs.com/airwindow/p/4644421.html
Copyright © 2011-2022 走看看