undo git reset

git reset soft HEAD~1 // undo last commit but keep the change

git reset hard HEAD~1 // undo last commit and discard the committed change

Undo the commit:

git reflog
3f6db14 HEAD@{0}: HEAD~: updating HEAD
d27924e HEAD@{1}: checkout: moving from d27924e0fe16776f0d0f1ee2933a0334a4787b4c
git reset HEAD@{1} (or git reset d27924e)





atop -r y -b 18:00 -e 18:00

-r: read

-b: begin time

-e: end time

atop -r -b 18:00 // no need to specify time for today’s data

atop -r 20150624 -b 18:00 -e 08:00 // specify date for the file to look up

atop => show cpu, memory at a time in the past

vim setup

auto complete

” Autocomplete already-existing words in the file with tab (extremely useful!)
function InsertTabWrapper()
let col = col(‘.’) – 1
if !col || getline(‘.’)[col – 1] !~ ‘\k’
return “\<tab>”
return “\<c-p>”
endfunction¬† “define a function
inoremap <tab> <c-r>=InsertTabWrapper()<cr> “define <tab><c-r> to trigger the function


git patch



  1. git format-patch HEAD^n..HEAD  (it patches the commit excludes the last nth and includes the head; e.g., n = 1, then it patches only the last commit), then you will see a file usually beginning with 00.
  2. scp the patched file to the destination, another machine or maintainer
  3. on the destination, git am patch_file_path (the patched file has directory information of the repository, so it does not matter under which directory you run this command)

remote branch

git diff origin/master 
to see all the changes that you have committed but not yet pushed

git remote show origin
to show which remote branch is tracked by your local branch
By default, your local branch change will be pushed to 
the remote one with the same name in addition with the prefix "origin/".
e.g. personal_branch -> origin/personal_branch

git log --author="FirstName LastName"
find the commit from a particular person