Skip to content

Instantly share code, notes, and snippets.

View dougdyson's full-sized avatar

Unfamous Dyson dougdyson

View GitHub Profile
@dougdyson
dougdyson / git_new_local_branch.md
Created November 2, 2020 01:44 — forked from nanusdad/git_new_local_branch.md
Git - create new local branch push to GitHub
@dougdyson
dougdyson / gist:932465716534ab6523d58c4f20fa6f51
Created October 17, 2020 22:37 — forked from trongthanh/gist:2779392
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@dougdyson
dougdyson / gist:a8267db07b640b878da4d7567f967001
Last active July 22, 2020 01:56 — forked from jagregory/gist:710671
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git init