Last active
August 12, 2021 18:03
-
-
Save aaronmarkham/4f417775458e0231316d618336a386df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To setup initial repo | |
export USER=aaronmarkham | |
export REPO=amazon-sagemaker-examples | |
export REPO_URL=https://github.com/aws/amazon-sagemaker-examples | |
git clone --recursive https://github.com/${USER}/${REPO}.git ${USER}-${REPO} | |
cd ${USER}-${REPO} | |
git remote add upstream ${REPO_URL} | |
# Need to add user/email and auth settings steps | |
git config --global push.default simple | |
git config --global user.name | |
# To sync up and rebase | |
git fetch upstream | |
git rebase upstream/main | |
git pull | |
# git pull and git push will force a merge commit message screen | |
# To create a branch with tracking: | |
export MY_BRANCH=branch_name | |
git checkout -b ${MY_BRANCH} origin/main | |
git push origin ${MY_BRANCH} | |
not needed | |
#git checkout -b ${MY_BRANCH} --track upstream/master | |
#git branch --set-upstream-to=upstream/master ${MY_BRANCH} | |
# force a sync with upstream | |
git remote add upstream /url/to/original/repo | |
git fetch upstream | |
git checkout master | |
git reset --hard upstream/master | |
git push origin master --force | |
# sometimes you need to fix the submodules | |
git submodule update --init --recursive | |
# Test someone elses PR on top of your code: | |
# git remote add NAME FORK | |
git remote add lanking520 https://github.com/lanking520/incubator-mxnet.git | |
# git pull --rebase NAME BRANCH | |
git pull --rebase lanking520 skip-test | |
# rollup commits | |
git rebase -i HEAD~4 | |
# using patches | |
# use space separated files | |
git diff anna.py > ~/Desktop/newdifff.diff | |
git apply ~/Desktop/newdifff.diff | |
git commit --fixup <commit> automatically marks your commit as a fix of a previous commit | |
git rebase -i --autosquash automatically organize merging of these fixup commits and associated normal commits | |
git checkout master -- myplugin.js | |
git commit -m "Update myplugin.js from master" | |
# to ignore stuff for a single repo, edit .git/info/exclude and add a pattern like (to filter from any dir): | |
**/settings.ini | |
# to apply this if the file is already staged, you then need to run | |
git update-index --assume-unchanged settings.ini | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment