0
我正在備份我們的開發VSTFS Git存儲庫中的一些數據。當我運行構建時,當然構建目錄被擦除,與Git倉庫同步,數據從外部源下載,然後推回到Git。爲什麼Git需要快速進行VSTFS構建?
但是,每次發生這種情況時,即使我在推動之前先做Git pull,它也會說我落後了,需要快速前進。所以我做了一個Git pull -ff。
但是,我想了解更多爲什麼發生這種情況。是否因爲每次都擦掉目錄?
以下是編譯: https://drive.google.com/file/d/0B8bQlVTjVjdoSWR6ZkhGOVNTd0U/view?usp=sharing
可以忽略PowerShell的,只是檢索數據。
這是批處理文件
ECHO ADD GIT TO PATH
PATH %PATH%;C:\Program Files\Git\cmd
ECHO TEST PATH
set PATH
ECHO GIT STATUS
git status
ECHO GIT CHECKOUT MASTER
git checkout master
ECHO GIT PULL FASTFORWARD
git pull origin master -ff
ECHO GIT ADD ALL
git add -A
ECHO GIT COMMIT ALL
git commit -m "Backing up Octopus P01 and P02"
ECHO GIT PUSH
git push origin master
沒有-FF
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'http://xxxxxx:8080/tfsdev/xxxxx/_git/Development.Services'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
另一種方式,我發現解決這個是選擇清潔=真正在構建存儲庫設置。這包括清理和重置
Syncing repository: Development.Services (Git)
Running 'git clean -fdx' on D:\BuildAgents\_work\7\s.
Running 'git reset --hard HEAD' on D:\BuildAgents\_work\7\s.
HEAD is now at ****** Updated GitTest.bat
Starting fetch...
Checking out ****** to D:\BuildAgents\_work\7\s
Checked out branch refs/heads/master for repository Development.Services at commit ******
您在構建之前還是之後拉動?什麼是事件的確切順序?你是否正在遵循這個指南? https://www.visualstudio.com/en-us/docs/git/gitquickstart – Schwern
爲了更清楚地說明,這是在Web門戶中,而不是在Visual Studio中。 – user1869558
拉動發生在構建。 – user1869558