• 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

  • 相关阅读:
    eventbus 备注
    Retrofit 备注
    RxJava 备注
    dagger2 备注
    JVM 备注
    UI控件(UIPickerView)
    Android 知识杂记(MVP模式)
    UI控件(UIToolbar)
    UI控件(UIAlertController)
    UI控件(UIScrollView)
  • 原文地址:https://www.cnblogs.com/airwindow/p/4644421.html
Copyright © 2020-2023  润新知