技能新法:更新 blog 文件后,清晰、快速同步到 github

2015/11/18 posted in  技能新法 comments

因为使用MWeb管理博客,基本上任一处改动,它都需要重新打包文件生成网页。
(一次改动就涉及多个文件,它没有将改动直接同步到github的功能。)

  • 文件夹里面哪些已经被它改动了,缺少清晰的提示。

  • 每次更改后,要全部本地文件都提交到远程仓库又不合理。

  • 那么有哪些git的命令能让我们更容易省事呢?

换个思路,其实也方便清晰知道哪些文件被改动了,然后就快速了。

###我使用如下步骤完成:

  1. 使用 git status 查看不同;

  2. 使用git commit -a 唤出哪些漏掉了没有及时commit ,此时终端会自动打开编辑器Vim (Vi),在里面完成编辑,:wq 退出 即可;

  3. 使用 git push origin master 完成提交

###本文改动后,实现过程的代码如下

$; git status                                    2.2.1p85
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
 21
 20 # Please enter the commit message for your changes. Lines starting
 19 # with '#' will be ignored, and an empty message aborts the commit.
 18 # On branch master
 17 # Your branch is up-to-date with 'origin/master'.
 16 #
 15 # Changes to be committed:
 14         modified:   14477276500009.html
 13         modified:   14477491132970.html
 12         modified:   14477519570037.html
 11         modified:   14477677420859.html
 10         modified:   all.html
  9         modified:   archives.html
  8         modified:   atom.xml
  7         modified:   index.html
  6         modified:   sitemap.xml
  5         modified:   猫技术.html
  4         modified:   聘方.html
  3 #
  2 # Untracked files:
  1         MWeb与github发布.html
22  #
~
 NORMAL ▶ ⎇ master ▶ .git/COMMIT_EDITMSG[+]      ◀ gitcommit ◀◀ 100% ¶  22:  1
".git/COMMIT_EDITMSG" 22L, 588C [w]
[master a11c890] 	modified:   14477276500009.html 	modified:   14477491132970.html 	modified:   14477519570037.html 	modified:   14477677420859.html 	modified:   all.html 	modified:   archives.html 	modified:   atom.xml 	modified:   index.html 	modified:   sitemap.xml 	modified:   猫技术.html 	modified:   聘方.html 	MWeb与github发布.html
 11 files changed, 255 insertions(+), 2 deletions(-)

ArvinYu at yandongdeMacBook-Pro in ~/git/ywriter/yuyandong.github.io  [A1u] [master]
:$; git push origin master                        2.2.1p85
Counting objects: 12, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 4.02 KiB | 0 bytes/s, done.
Total 12 (delta 10), reused 0 (delta 0)
To git@github.com:yuyandong/yuyandong.github.io.git
   e517174..a11c890  master -> master



欢迎联系 Arvin Yu , 邮箱:yuyandong@outlook.com

本作品采用 知识共享署名-非商业性使用-禁止演绎 3.0 Unported许可协议 进行许可。