0%

Git Notes

Merge a remote pull to the current branch

  1. Add the following script to ~/.gitconfig

    1
    2
    [alias]
    pr = "!f() { git fetch ${2:-upstream} pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
  2. Use git pr PULL_NUM to download the pull, for example, use git pr 577 to checkout pr 577 into a branch called pr/577

  3. Merge the above branch to the target branch, for example git merge pr/577

Rebase

1
2
3
4
5
6
git pull --rebase upstream master
git status
git add scripts/nn/test/run_tests.dml
git add -u
git rebase --continue
git push --force

Change branch to master

1
2
git branch -m old-name new-name
git branch master -u origin/master