• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Export Word
    • Attachments
    • Page Information

    Loading...
  1. Dashboard
  2. Skara
  3. Skara
  4. CLI Tools
  5. git-backport

git-backport

Skip to end of metadata
  • Created by Erik Helin, last modified by Ludvig Janiuk on Apr 01, 2022
Go to start of metadata

Description

git-backport fetches a commit from a remote repository and applies it on top of the current branch. Conceptually git-backport is similar to the following two Git commands:

  1. git fetch <REMOTE-REPO> <HASH>
  2. git cherry-pick FETCH_HEAD

git-backport will always use the commit message "Backport <HASH>" for the new commit to make it easier to create a "backport pull request" (for example via git-pr-create).

Usage

git-backport [options] --from <REMOTE-REPO> <HASH>

Examples

git backport --from https://github.com/openjdk/jdk9 8f73a84a15dacfa2cfa6caac3c2a7f1edad0b00f

Configuration

 git-backport [options] <HASH>
-u, --username NAME Username on host
--from REPO Repository to backport from
--verbose Turn on verbose output
--debug Turn on debugging output
--version Print the version of this tool
-h, --help Show this help text

Backporting commits in mercurial repositories

Most mercurial repositories have git mirrors, and it's possible to use the commit in the git mirror repository for backporting. There is sadly no direct link between hg commits and their corresponding git commits. So, to find the right commit, you have to search for the commit message (often including a unique bug ID, good for searching) in the git mirror's commit history.

For example, imagine you wanted to backport commit https://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/5da31e88dbf5 "8047720: Xprof hangs on Solaris" in git. Doing the following won't work:

git backport --from https://hg.openjdk.java.net/jdk9 5da31e88dbf5

The git mirror repository is https://github.com/openjdk/jdk9. What is the corresponding git commit's SHA? To find it, you can search for "8047720" in the git mirror, and that helps you find "8f73a84a15dacfa2cfa6caac3c2a7f1edad0b00f". So, to backport that commit, what you actually want to do is:

git backport --from https://github.com/openjdk/jdk9 8f73a84a15dacfa2cfa6caac3c2a7f1edad0b00f

Source

See GitBackport.java.

Overview
Content Tools
ThemeBuilder
  • No labels

Terms of Use • License: GPLv2 • Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Adaptavist ThemeBuilder Powered by Atlassian Confluence 7.13.8
  • Adaptavist ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Adaptavist ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 136, "requestCorrelationId": "59e38edfa0bd8e3d"}