Skip to content

Instantly share code, notes, and snippets.

@koaps
Last active December 2, 2018 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koaps/83e67e9d43dd5e1fc4937037dbe4f6d6 to your computer and use it in GitHub Desktop.
Save koaps/83e67e9d43dd5e1fc4937037dbe4f6d6 to your computer and use it in GitHub Desktop.
Git Stuff

Git notes and commands

Author reset

git filter-branch --env-filter 'if [ "$GIT_AUTHOR_EMAIL" = "koaps" ]; then
     GIT_AUTHOR_EMAIL=koaps@users.noreply.github.com;
     GIT_AUTHOR_NAME="Koaps";
     GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL;
     GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; fi' -- --all

git push -f origin master

Clean Git log

git checkout --orphan latest_branch

git add -A

git commit -am "initial"

git branch -D master

git branch -m master
 
git push -f origin master

Add Upstream for Forked repos

git remote -v

origin	git@github.com:koaps/debian-stretch-zfs-root.git (fetch)
origin	git@github.com:koaps/debian-stretch-zfs-root.git (push)


git remote add upstream https://github.com/hn/debian-stretch-zfs-root


git remote -v

origin	git@github.com:koaps/debian-stretch-zfs-root.git (fetch)
origin	git@github.com:koaps/debian-stretch-zfs-root.git (push)
upstream	https://github.com/hn/debian-stretch-zfs-root (fetch)
upstream	https://github.com/hn/debian-stretch-zfs-root (push)


git fetch upstream

From https://github.com/hn/debian-stretch-zfs-root
 * [new branch]      master     -> upstream/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment