How to undo (almost) anything with Git
https://github.blog/2015-06-08-how-to-undo-almost-anything-with-git/
https://github.blog/2015-06-08-how-to-undo-almost-anything-with-git/
checkout, reset, restore, revert, and switch. What do they really do?
Written by torek, etc.
The whole page is useful, especially from 'To add to VonC's answer, and bring into the picture all the relevant commands, in alphabetical order, I will cover:'
I also like -
$git restore -s@ -SW -- <file>
above the aforesaid section.
How to undo and redo in git?
For both undo and redo, use git reflog and git reset --hard head@{n}
You will find n in the result of git reflog.
How to find what the git merge conflicts are?
After you run
$git merge <branch name 2>
If the merge failed, and it said that there was a conflict, the error message would tell you in which file the conflict was - 'Merge conflict in <file name>'.
Run -
$git diff <current branch name> <branch name 2> <file name>
you will get what the conflict is. Content in red is the change done in <current branch name>, and that in green is the change done in <branch name 2>.
source $VIMRUNTIME/vimrc_example.vim
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg1 = substitute(arg1, '!', '\!', 'g')
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg2 = substitute(arg2, '!', '\!', 'g')
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let arg3 = substitute(arg3, '!', '\!', 'g')
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
let cmd = substitute(cmd, '!', '\!', 'g')
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
" 字符编码{{{
" Vim显示的编码(设置这个不会改变文件的编码){
if has('win32') || has('win64')
set encoding=utf-8
set termencoding=chinese
endif
" }
" 编辑已存在的文件时的参考文件编码.需要注意顺序,前面的字符集应该比后面的字符集大{
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
" }
" }}}
"
"
filetype plugin indent on
autocmd FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType python setlocal expandtab shiftwidth=4 softtabstop=4
set number
"
"
" The following commands do not work
" autocmd FileType html
" set omnifunc=htmlcomplete#CompleteTags
" The following commands do not work
" set omnifunc=csscomplete#CompleteCSS
" autocmd FileType css set omnifunc=csscomplete#CompleteCSS
" html css class id auto complete
" https://github.com/Shougo/neocomplete.vim
let g:neocomplete#enable_at_startup = 1
Several Issues about Responsive Web Pages and HTTPS
1. Texts and images are not aligned to HTML5 animations viewed on phones
They are aligned on computer monitors.
Cause: width of text and images are '100%', but that of the animation is '1140px'.
Solution: After I changed width into '100%' and height into 'auto' in -
(1) 'animation_container' div;
(2) canvas;
(3) 'dom_overlay_container' div,
the text and images have become aligned to the html5 animation now.
(Got help from 'Cypher- Entrepreneur')
2. There is a link on the image banner, but when viewed in browser, there is no link.
Cause: '>' is missing in <div> of <div><a href=""><img ...></a></div>
Solution: Inserted the missing '>', then the link on the image banner works now.
Note: (1) Better use 'Sublime Text' software to edit code files.
(2) Better use https://www.aliciaramirez.com/closing-tags-checker/ to check if any closed tag is missing.
(Got help from 'Cypher- Entrepreneur')
3. Website completely normal visited outside of our company LAN network, but can not open at all in LAN
Cause: IP of CloudFlare has changed.
Handling: The IP on our LAN DNS server which is mapped to our website domain was 104.28.30.95, which is an IP of CloudFlare.
Since we can not open our website at all, I changed IP on our LAN DNS into 64.91.250.231, which is the IP when we ftp and upload our website files. After the change, we can open our website, but (1) it is http, not https, 'not secure' shows. (2) none of our html5 animations show up, and some of the images do not show.
Pinging website domain name from out of LAN, IP addresses are (1) 172.67.133.250 (2) 104.21.25.97. Pinging website domain name from within LAN, IP is 64.91.250.231, of course.
Solution: changed the IP on LAN DSN from 64.91.250.231. The problem is gone. Website becomes normal viewed whether from out of LAN, or in LAN.
(Got help from 'Benjamin Gao)
4. On home page of website, there are two html5 animations. The first animation shows up fine, but the second one does not show.
If I remove the first animation, then the second animation shows.
Cause: </iframe> for the second animation is missing.
Solution: Added </iframe>. The second animation shows.
5. The distance between the two animations is too far away.
Cause: 'vh' in 'min-height:98vh' cause the distance.
Solution: Removed 'min-height:98vh'. The space in vertical direction disappeared. But there is a big blank space horizontally.
Using responsive iframe solved the problem of the problem of big blank space horizontally.
(Got help from 'Cypher Entrepreneur')