git 本地提交未推送 不小心遷出、刪除後 的找回方法!
使用Git進行本地提交後,未上傳提交,卻不小心刪除了本地提交或提交所在分支,怎麼辦?????
不要緊!!!!
可以使用git reflog命令來幫助恢復刪除的本地提交!
執行以下命令你就知道怎麼用了!
git stash 清空工作區和暫存區
git pull 同步伺服器程式碼
git commit –allow-empty -m “this is a test” 進行一次空提交
git reset HEAD^ –hard 刪除剛才的空提交
git reflog 檢視各分支的提交記錄
70cf5fe HEAD@{0}: reset: moving to HEAD^
28d447f HEAD@{1} : commit: this is a test
70cf5fe HEAD@{2}: pull: Fast-forward
git reset 28d447f –hard 恢復到commit號為28d447f 的提交,亦可使用HEAD@{1}
git log
看this is a test 提交是不是回來了!!
相關推薦
git 本地提交未推送 不小心遷出、刪除後 的找回方法!
使用Git進行本地提交後,未上傳提交,卻不小心刪除了本地提交或提交所在分支,怎麼辦????? 不要緊!!!! 可以使用git reflog命令來幫助恢復刪除的本地提交! 執行以下命令你就知道怎麼用了! git stash 清空工作區和暫存區 git p
git 本地倉庫同時推送到多個遠端倉庫
先準備兩個空的遠端倉庫如果遠端倉庫裡有readme這樣的檔案,先pull一下,如果pull的時候失敗,提示:fatal: refusing to merge unrelated histories那麼在進行git pull 時,新增一個可選項git pull origin m
使用git命令將本地項目推送到遠程倉庫
替換 readme.md 項目 sage mage message 如何 執行 寫實 將本地項目推送到遠程倉庫 這裏先放一張圖, 有助於理解git命令 1. 在GitHub上新建一個倉庫 註意不要勾選自動生成README.md文件, 否則會產生某些問題, README.m
Git for Windows之推送本地版本庫到遠端倉庫
Git for Windows之基礎環境搭建與基礎操作中介紹了Git基本環境的構建與基本的操作.生成了一個本地git版本庫,本文將介紹如何將這個版本庫推送到遠端倉庫(碼雲,github也可以). 1、註冊碼雲的賬號,建立一個public的專案 點選進入該專案,有如下資訊: (1)、紅
GitHub學習(三):Phpstorm中的git使用(1)--建立本地倉庫與推送
這段時間在學php的laravel框架,用的開發軟體是xampp建站整合軟體和phpstorm,前幾天做完了表單處理工程,因為上班和在家用的是兩臺電腦,所以需要用github來儲存程式碼,在這裡記錄下phpstorm中的git使用,以免以後忘了。 我已經寫了一部分的程式碼的工程,我現在的第一步就是
在本地用命令列建立一個倉庫git 倉庫,並推送到遠端
首先,進入的gitStore目錄下(沒有的話自己建立一個) 1.git init 在gitStore目錄下 初始化一個git倉庫 2.git add 複製一個檔案到gitStore目錄下,然後執行git add . 將“修改”從當前工作區存放到暫存區 3.git co
git 初始化本地專案並推送到遠端
有一個新專案,開發了一些程式碼之後想推送到遠端,具體的操作方式和命令如下: (使用 git bash) 1、切到專案目錄中,例如 E:\git\smart-open 2、初始化git倉庫並在本地提交 //初始化git倉庫 git init //將當
git將本地分支程式碼推送至GitLab遠端
0.gitlab上已存在專案 前提,我們gitlab伺服器上已經有專案了 1.初始化本地倉庫 git init 2.方式一:更新遠端倉庫地址,<URL>更換為新的url地址。 gi
git建立本地分支以及推送本地分之至遠端分支
Git分支策略 實際開發中,應當按照以下幾個基本原則進行管理: 首先,master分支應該是非常穩定的,也就是僅用來發布新版本,平時不能再上邊幹活。 那在哪幹活呢?幹活都在dev分支上,也就是說,dev是不穩定的,到某個時候,比如1.0版本釋出的時候,在將dev分支合併到m
git 查看遠程分支、本地分支、創建分支、把分支推到遠程repository、刪除本地分支
cli one cmd util ace http span toc tor git 查看遠程分支、本地分支、創建分支、把分支推到遠程repository、刪除本地分支 [plain] view plain copy $ git branch -
利用tortoisegit將本地項目推送至gitlab指定group
這一 sig 指定 因此 group tlab 重復 管理 gin 直接上步驟: 1、在gitlab上新建group,如下圖,右上角有個 "+",點擊可以選擇新建project、group、snippet。然後取名,此名字在gitlab上具有唯一性,因此可能會提示重復,比如
git 創建與推送分支
ref clas align check 抓取 tps ble git push ria 1:創建本地分支 dev $ git branch dev 切換至 dev 分支 $ git checkout dev 2:查看當前分支 $ git branch * dev
Docker 本地鏡像推送到阿裏雲
inux 阿裏 ref 版本號 如何 mil systemctl -h system 最近在學習Docker,從安裝Docker開始,到自定義制作鏡像mycentos,但是怎麽把它推送到阿裏雲,一直是困擾我的問題。後面有時間了解了一下,根據本地鏡像推動到阿裏雲其實並沒有
Docker搭建本地倉庫並推送映象到本地倉庫
Dockers不僅提供了一箇中央倉庫,同時也允許我們使用registry搭建本地私有倉庫; 一、本地下載registry sudo docker pull registry:2 二、啟動容器執行registry映象 docker run -d -p 5000:5000 -v /
Git 本地提交時,忽略特定檔案或目錄
https://blog.csdn.net/huzhenwei/article/details/7426093 在將某個目錄新增到git版本庫、或提交某個git版本庫的改動時,可能希望忽略掉一些檔案或目錄(如編譯時生成的.o、.a檔案等),可以修改.git/info/exclude檔案來實現。
Git本地提交程式碼到遠端倉庫
Git常用命令 1、(先進入專案資料夾)通過命令 git init 把這個目錄變成git可以管理的倉庫 git init 2、把檔案新增到版本庫中,使用命令 git add .新增到暫存區裡面去,不要忘記後面的小數點“.”,意為新增資料夾下的所有檔案 git add .
git新建分支並推送至遠程倉庫庫
是否 切換 origin sta 分支 分享圖片 提交 ranch ima git新建分支並推送至遠程倉庫庫 新建分支 git branch bra_name 切換分支 git checkout bra_name 推送 git push -u origin bra_na
git 本地項目推到遠程倉庫
row log hub blog ria class pro read git init …or create a new repository on the command line echo "# blog" >> README.mdgit initgit
將本地repo映象推送到遠端gerrit伺服器
1、獲取遠端供應商的repo映象 repo init --mirror -u ssh://[email protected]$host_name:29418/manifests -b xx_branch --repo-url=ssh://[email protected]$h
git建立分支並推送到遠端分支
首先,先檢視自己所在分支上是否有沒有上傳的修改處:git branch;如若沒有,則直接可以建立並且換到所建立的分支目錄。 GIT建立分支以及上傳伺服器 git checkout -b xxxxxx 檢視分支:git branch 1,建立+切換分支:git chec