Git

PHOTO EMBED

Wed Mar 17 2021 09:27:36 GMT+0000 (UTC)

Saved by @hazel #bash

git branch branch-name # create branch
git checkout branch-name # switch to branch
git branch -m branch-name # rename branch
git fetch repo-name # get remote updates
git branch --set-upstream-to=repo-name/remote-branch local-branch # link branches

git push -u origin remote-branch # set current branch upstream of remote branch and push

git branch -d branch-name # delete local branch
git branch -D branch-name # delete unmerged local branch

git log --oneline # view commits
git reset stashhash # view previous commit
git reset --hard # cancel revert commit
git revert HEAD # revert commit remote as well as local

git commit -am "message" # commit
git add . # add another file
git commit --amend --no-edit # add file without changing message

git stash --include-untracked # stashing with untracked files
git stash push -m "stash name" # name stash
git stash list # list stashes
git stash pop stash@{n} # pop stash

# squash branch into one commit
git checkout sprint-branch
git merge --squash task-branch
git commit --amend 'commit message'
git push

# generate ssh key
ssh-keygen
cat ~/.ssh/id_rsa.pub
content_copyCOPY