git

Pull from upstream

git pull upstream master

Add all modified files

git add -u

Add new files

git add .

Add deleted files

git add .

Add everything except one thing

git add .
git reset your/file.js

Make an additional commit on the most recent one, without making a new commit

Make changes you want locally
git add -u
git commit --amend --no-edit
git push origin -f 4704-feature

Merge changes from one branch to another

Squash all commits into one commit

Delete all local branches except master

git branch | grep -v "minside-dev" | xargs git branch -D

Delete a branch

Rename a branch

Uncommit last commit

git reset --soft HEAD^

Nuking a commit

Remove a commit inside the git log

Set up multiple users:

  • Can confirm by checking vi .git/config

Setting up Multiple Git Configs

  • Setting up two ssh keys: https://gist.github.com/jexchan/2351996

  • To use a particular user (Waleed-Chaudhry is the user here) for a given repo

    • Go to the repo

    • vi .git/config

    • Switch url from git@github.com:Waleed-Chaudhry/jQuery.git to git@github.com-Waleed-Chaudhry:Waleed-Chaudhry/jQuery.git

    • Or https://github.com/timothyylim/axo-minside-private to https://github.com-timothyylim/timothyylim/axo-minside-private

Migrate a repo from bitbucket to git

Submodules

Last updated