Skip to content

Instantly share code, notes, and snippets.

@stevemar
Last active January 23, 2024 19:11
Show Gist options
  • Select an option

  • Save stevemar/06ace005f82691435d0b to your computer and use it in GitHub Desktop.

Select an option

Save stevemar/06ace005f82691435d0b to your computer and use it in GitHub Desktop.
git cheatsheet

Remote Rebasing

Click "Rebase" button in the Gerrit UI under your patch set.

Local rebasing

  1. git review -d $PARENT_CHANGE_NUMBER
  2. git review -x $BROKEN_CHANGE_NUMBER
  3. fix the issues
  4. git add
  5. git cherry-pick --continue
  6. git review

Undo a git commit amend

  1. git reflog (to find the number)
  2. git reset --soft HEAD@{number}
  3. git commit -C HEAD@{number}

backporting a patch

  1. create a branch
  2. git checkout -b your_branch_name remotes/origin/stable/havana
  3. hack hack hack
  4. commit changes
  5. git review stable/havana

creating a new oslo library

Before starting, create a new repo within your own github account do not set a license or description. The following example uses oslo.io, so io is used throughout this doc.

cd /tmp
mkdir graduation
cd graduation
git clone git://git.openstack.org/openstack/oslo-incubator
git clone git://git.openstack.org/openstack/oslo-incubator oslo.io
cd oslo.io
../oslo-incubator/tools/graduate.sh io openstack/common/fileutils.py tests/unit/test_fileutils.py

# may not be necessary, but they didn't run for me
# $bindir/apply_cookiecutter.sh $new_lib
# git add .
# git commit -m "exported from oslo-incubator by graduate.sh"

1. Add missing dependencies
2. Fix broken imports
3. Make sure the tests run
4. Make sure pep8 passes
5 Syncing dependencies from the incubator

git remote add stevemart https://github.com/stevemart/oslo.io.git
git push -u stevemart master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment