Git Patch generation and use

Source: Internet
Author: User

Preface

Due to the need for work, changes based on the source code often need to play a variety of patches on the GIT branch to solve a variety of problems. Here are two ways to generate patches and patch.

git diff

This is a patch under UNIX, generated by the git diff command under the Git branch. The specific commands are as follows:

git diff > diff.patch

For the patch generated by Git diff, you can merge with the following two commands:

git apply diff.patch

Or

patch -p1 < diff.patch
git format-patch

Git-specific patches are generated through Git format-patch. The usual methods are as follows:

    1. Git Format-patch-n (-n represents the patch to generate the most recent n commits)
    2. Git format-patch commit-id-1 commit-id-2 (Build node 1 Patch relative to Node 2)

Git-specific patches are directly through the git am command merge.

0001-....-patch

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Git Patch generation and use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.