Skip to content

Instantly share code, notes, and snippets.

@jankapunkt
Created August 19, 2019 04:58
Show Gist options
  • Save jankapunkt/53fb29e3d4eb75fc01cc0a3101487608 to your computer and use it in GitHub Desktop.
Save jankapunkt/53fb29e3d4eb75fc01cc0a3101487608 to your computer and use it in GitHub Desktop.
Initializes a new repo and merges it with a new origin
#!/usr/bin/env bash
# init repo and initially add all files
# ignore should exist before already
git init
git add -A
git commit -a -m "initial files added"
# add the new remote and merge them
git remote add origin $1
git fetch
git branch --set-upstream-to=origin/master master
git pull --allow-unrelated-histories
git pull --no-edit origin master
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment