Git

From Deathbybandaid Wiki
Revision as of 20:11, 8 December 2021 by Deathbybandaid (talk | contribs) (Created page with "This is a cheatsheet for git stuff ==Pull a specific directory== <nowiki>git -C /home/sopel/sopel/ pull</nowiki> ==Syncing your fork with upstream== Step 1) configure remote repository as upstream <nowiki>git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git</nowiki> Step 2) checkout your branch to sync, usually master <nowiki>git checkout master</nowiki> Step 4) fetch upstream <nowiki>git fetch upstream</nowiki> Step 4) merge upstream <n...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is a cheatsheet for git stuff

Pull a specific directory

git -C /home/sopel/sopel/ pull

Syncing your fork with upstream

Step 1) configure remote repository as upstream

git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

Step 2) checkout your branch to sync, usually master

git checkout master

Step 4) fetch upstream

git fetch upstream

Step 4) merge upstream

git merge upstream/master

rebase

Step 1) checkout your branch to sync

git checkout branchname_to_update

Step 2) rebase branch to master

git rebase -i master

Step 3) squash commits into one

Step 3) select commit messages to keep

Step 4) push changes

git push -f origin branchname_to_update

ammend commit names

git commit --amend

force local repo to align with remote

git fetch origin
git reset --hard origin/master

delete branch locally

You must be on a different branch

git branch -D branchname_to_delete