Search code examples
gitversion-controlgit-patch

What is a patch in Git version control?


I am new to both Git and version control so I am trying to figure out what a patch is and how is it different from the rest of activities I do in Git?

When do I apply a patch? Does it happen every time I commit?


Solution

  • You can see in this blog post how you can create a patch (collection of changes you want to communicate and apply to another repo)

    git patch
    (picture from the 2008 blog post "Bioruby with git: how would that work?", published by Jan AERTS)

    See also Contributing to Rails with Git as another concrete example.

    Nowadays, the GitHub pull request makes it really easy to apply patches on GitHub repos, which is useful when you aren't a direct contributor (ie you have no right to directly push to a repo).
    Actually, fairly recently GitHub introduced "Better Pull Request Emails" to improve the notification of new patches.