Git 遷庫 標籤

 

Git遷庫git

(一)克隆裸庫github

      克隆以後進入該目錄下是這樣的fetch

image

 

(二)建立新的版本庫url

        這裏我已經建立了一個新庫,地址是https://github.com/SunArmy/test.gitspa

 

(三)以鏡像推送的方式將裸庫提交到新版本庫3d

git push --mirror https://github.com/SunArmy/test.git

image

如今咱們已經把老版本庫遷移到了新的版本庫,並且還包含提交日誌日誌

 

Git標籤code

1) 列出全部標籤blog

git tag

 

2) 建立標籤rem

git tag -a V1.0 -m '初版' 6d1cc8bc5f08f2d70f956a0300fb2d64871f9ab0

-a  : 後面跟標籤名

-m : 後面是標籤備註

最後的串是  你指定的提交 校驗和

3) 查看標籤

git show V1.0

 

4) 刪除標籤

git tag -d V1.0

 

 

 

Git命令

建立版本庫
git clone <URL>                   # 克隆遠程版本庫
git init                          # 初始化本地版本庫

修改和提交
git status                        # 查看狀態
git diff                          # 查看變動內容
git add .                         # 跟蹤全部改動過的文件
git add <file>                    # 跟蹤指定的文件
git mv <old> <new>                # 文件更名
git rm <file>                     # 刪除文件
git rm --cached <file>            # 中止跟蹤文件但不刪除
git commit -m 'message'           # 提交全部更新過的文件
git commit --amend                # 修改最後一次提交


查看提交歷史
git log                             # 查看提交歷史
git log -p <file>		    # 查看指定文件的提交歷史
git blame <file>		    # 以列表方式查看指定文件的提交歷史


撤銷
git reset --hard HEAD		    # 撤銷工做目錄中全部未提交文件的修改內容
git checkout HEAD <file>            # 撤銷指定的未提交文件的修改內容
git revert <commit>		    # 撤銷指定的提交


分支與標籤
git branch  			    # 顯示全部本地分支
git checkout <branch/tag>	    # 切換到指定分支或標籤
git branch <new-branch>	            # 建立新分支
git branch -d <branch>		    # 刪除本地分支
git tag				    # 列出全部本地標籤
git tag <tagname>		    # 基於最新提交建立標籤
git tag -d <tagname>		    # 刪除標籤


合併與衍合
git merge <branch>		    #合併指定分支到當前分支
git rebase <branch>		    #衍合指定分支到當前分支


遠程操做
git remote -v			    #查看遠程版本庫信息
git remote show <remote>	    #查看指定遠程版本庫信息
git remote add <remote> <url>	    #添加遠程版本庫
git fetch <remote>		    #從遠程庫獲取代碼
git pull <remote> <branch>	    #下載代碼及快速合併
git push <remote> <branch>	    #上傳代碼及快速合併
git push <remote> :<branch/tag-name>
                        	    #刪除遠程分支或標籤
git push --tags		            #上傳全部標籤

更新遠程分之列表git remote update origin -p
相關文章
相關標籤/搜索