Last active
March 9, 2019 13:20
-
-
Save YordanGeorgiev/27d8e4a52f3b1376001296d9d14c67a5 to your computer and use it in GitHub Desktop.
[how-to-fork-a-new-git-proj] how-to for a new git proj by re-using the history of an old one #git #fork #app #project
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
# add the remote git host named "fork" | |
git remote add fork [email protected]:UserName/src_proj.git | |
# fetch all the data from the for | |
git fetch fork | |
# check the branches | |
git branch -a | |
# create and checkout the local target branch name | |
git checkout -b local_tgt_branch_name fork/src_branch_name | |
# checkout develop | |
git checkout develop | |
# make a backup of the current branch | |
curr_branch=$(git rev-parse --abbrev-ref HEAD); git branch "$curr_branch"--$(date "+%Y%m%d_%H%M"); git branch -a | grep $curr_branch | sort -nr | |
# and merge the changes into develop | |
git merge local_tgt_branch_name -S --allow-unrelated-histories -X theirs | |
# and check | |
git log --pretty --format='%h %ai %<(15)%an ::: %s' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment