Git

From Deathbybandaid Wiki
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