Trong trường hợp của bạn, để chuyển tiếp nhanh, hãy chạy:
$ git merge --ff-only origin/master
Điều này sử dụng --ff-only
tùy chọn git merge
, như câu hỏi đặc biệt yêu cầu "chuyển tiếp nhanh".
Đây là một đoạn trích từ git-merge(1)
đó cho thấy nhiều tùy chọn chuyển tiếp nhanh hơn:
--ff, --no-ff, --ff-only
Specifies how a merge is handled when the merged-in history is already a descendant of the current history. --ff is the default unless merging an annotated
(and possibly signed) tag that is not stored in its natural place in the refs/tags/ hierarchy, in which case --no-ff is assumed.
With --ff, when possible resolve the merge as a fast-forward (only update the branch pointer to match the merged branch; do not create a merge commit). When
not possible (when the merged-in history is not a descendant of the current history), create a merge commit.
With --no-ff, create a merge commit in all cases, even when the merge could instead be resolved as a fast-forward.
With --ff-only, resolve the merge as a fast-forward when possible. When not possible, refuse to merge and exit with a non-zero status.
Tôi nhanh chóng chuyển tiếp đủ để nó bảo đảm một bí danh:
$ git config --global alias.ff 'merge --ff-only @{upstream}'
Bây giờ tôi có thể chạy nó để chuyển tiếp nhanh:
$ git ff
git checkout HEAD
không bao giờ làm bất cứ điều gìHEAD
đã có nghĩa là cam kết thanh toán.