Skip to content

Instantly share code, notes, and snippets.

@LNA
Last active September 27, 2021 15:28
Show Gist options
  • Save LNA/61573d3b67f65fda8493279f2b9a5045 to your computer and use it in GitHub Desktop.
Save LNA/61573d3b67f65fda8493279f2b9a5045 to your computer and use it in GitHub Desktop.
New Branch WorkFlow

git fetch origin && git checkout -b name-of-new-feature-branch origin/release

or

git fetch origin && git checkout -b release origin/release

Check out someone elses branch:

git fetch origin && git checkout name-of-branch

Remove a speecific commit

git rebase -i HEAD~x change the word pick to drop for the commit we want to drop https://stackoverflow.com/questions/2938301/remove-specific-commit

@LNAllen
Copy link

LNAllen commented Aug 31, 2021

Put commits in a different order

git rebase -i HEAD~3
Where 3 is the number of commits that need reordering (source).

This will open vi, listing commits from oldest (top) to newest (bottom).
Now reorder the lines, save, and exit the editor.

ddp will move current line down
ddkP will move current line up (source)

@LNAllen
Copy link

LNAllen commented Sep 27, 2021

Remove the most recent commit
git reset --hard HEAD~1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment