git diff (working dir to INDEX )
git diff --cached (INDEX to HEAD)
git diff HEAD (working dir to HEAD)
git diff branchA (working dir to branchA)
checkout命令用于从历史提交(或者暂存区域)中拷贝文件到工作目录,也可用于切换分支。
git checkout file //从Index 到 working dir
git checkout branchA file //branchA 到 working dir
git checkouit HEAD file //当前分支 到working dir
git reset 如果不给选项,那么当前分支指向到那个提交(work不变,index变)。如果用--hard
选项,那么工作目录也更新,如果用--soft
选项,那么都不变(work,index)。
如果给了文件名(或者 -p
选项), 那么工作效果和带文件名的差不多,除了索引被更新。
git reset -- files
git push -f 强制提交
删除远程分支
- git branch -r -d origin/branch-name
- git push origin :branch-name
-
git push origin --delete tag v0.7
//已经add的文件,在gitignore中无效,删除重新add
git
rm
-r --cached .
git add .
git commit -m
'update .gitignore'
Git学习资料:http://rogerdudler.github.io/git-guide/index.zh.html
http://marklodato.github.io/visual-git-guide/index-zh-cn.html?no-svg
https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-clone
http://blog.sae.sina.com.cn/archives/3003
sublime text2
安装Package Control(插件管理器):通过ctrl+` 快捷键或 View > Show Console 菜单打开Sublime Text的控制台,并输入以下代码:
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()) 安装package Control(以上)
import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
ctrl + shift + p 调出工具面板 输入 ss javascript 设置语法
ctrl + alt +f格式化
Git使用http://gitlab.beisen.co/kongchangzhu/git-tutorial/tree/master
http://rogerdudler.github.io/git-guide/index.zh.html