Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. 如何使用 Git
  6. 如何在 Windows 中使用 Git
  7. 製造衝突
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

製造衝突

當出現衝突時,您需要解決衝突以完成您的工作。在這個步驟中,我們將使用我們現有的兩個儲存庫故意製造衝突,「tutorial」和「tutorial2」。

首先,開啟tutorial目錄中的sample.txt檔案。將下面的粗體文本新增到檔案中並提交。

Anyone can learn Git with this tutorial and Backlog


add: Register a change in an index commit: Save the status of an index

Record the status of commit index

接着,開啟tutorial2目錄中的sample.txt檔案。將下面的粗體文本新增到檔案中並提交。

Anyone can learn Git with this tutorial and Backlog


add: Register a change in an index pull: Obtain the content of the remote repository

pull Acquire the contents of a remote repository.

現在把tutorial2中的修改推送到遠端儲存庫。

Push to the remote repository

在我們目前的遠端儲存庫中,sample.txt档案包含第三行pull: Obtain the content of the remote repository,並且已經提交到歷史日誌中。

接下來,我們將把提交從我們的tutorial儲存庫推送到遠端儲存庫。

Git raises a conflict and rejects your push

如您所見,Git 引發了衝突並拒絕了您的推送。

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life