Git


title: Git
date: 2016-09-29 13:26:57
tags:
---html

我是前言

目的:搭建好了博客,不可能每次發表博客的時候都帶着我這臺臺式機亂跑吧,若是換到其餘電腦怎麼辦,博客的部署文件都在這臺電腦上,因此就想着同步到github上,又不想建立一個新的repo還單獨存儲源文件,就像在發佈的網站的repo中建立一個分支來存儲當前的blog源文件,因而風雨之路慢慢而來,由於這幾天要過10.1,因此趕忙整理一下這兩天git的學習內容git

準備工做

  • 建立repo而後建立本地庫,git pull 遠程庫 以下圖

建立分支

github

git checkout - b Hexo  //Hexo 是分知名 建立並切換到當前分支

//等價於下面
git branch Hexo

git checkout Hexo //

示意圖spring


遠程repo上查看segmentfault

本地命令行查看網絡

查看本地分支:

git branch

如圖hexo

查看遠程分支:

git branch -r

如圖學習


刪除分支
---網站

建立刪除都是經常使用的,我就一併概括了,雖然還沒用到命令行

git branch -d Hexo

切換分支

git checkout master (前面提到的)切換到主分支

將本地分支push到遠程分支

git push origin [name]

補充方法


git push origin test :master //將本地test分支做爲遠程的master分支



git push origin  test : test //將本地的test分支做爲遠程的test 分支

遇到的問題

1.hexo的兩個主題 git commit 時沒法提交
報錯信息:

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

    modified:   themes/next (modified content)
no changes added to commit (use "git add" and/or "git commit -a")```

>解決方案:

Bean HE http://kubiops.com/2015/09/06/ignore-dirty-status/


問題分析:

* 主要是看了解決方法,並非真正的將主題提交,而是ignore dirty(骯髒的) info in git ,因此我判定應該是github上開源的項目在提交的時候會自動鏈接到github上的遠程庫,去查看了一下遠程庫的狀態,以下圖

參考

相關文章
相關標籤/搜索