Git

https://agilewarrior.wordpress.com/2016/03/17/how-to-git-rebase-and-squash-commits/

Permission denied (public key)

ssh-add ~/.ssh/id_rsa_gmail
ssh-add ~/.ssh/id_rsa_yahoo
ssh-add -l

Commands

git rebase -i SHA (squash)
git remote prune origin (prune remotes)

Revert all changes

git clean -df
git checkout -- .

How to checkout someone elses remote branch

git remote add joe git@ghe.xxx.net:joe/library.git
git fetch joe player_state_notifications
git checkout player_state_notifications

How to update submodules

git submodule update --init --recursive

export repos

git checkout-index -a -f --prefix=/destination/path/
git checkout-index -a -f --prefix=/Users/jr/Downloads/temp/

Note: double — dash on prefix

Multiple branches to find bug

git checkout -b aNewBranch1 SHA1 (test)
git checkout -b aNewBranch2 SHA2 (test)
git checkout -b aNewBranch3 SHA3 (got it!)

git branch -D aBranchToDelete
git difftool branch1 branch2

How to configure a new fork

git remote add upstream 
git remote set-url --push upstream no_push
git config remote.pushdefault origin
git config --global push.default simple
git config --global pull.rebase true

How to checkout someone else remote branch

git remote add jr git@ghe.xxx.net:jr/project.git
git fetch jr branch
git checkout branch

How to cherry pick

git checkout 
git log (note has of commit you want to cherry pick)
git checkout 
git cherry-pick -x SHA 

How to merge a remote branch

git merge remotes/origin/release/next

Misc commands

git log --author="xxx" --graph --oneline --no-merges
git branch -a (shows all remote branches)
git log --grep="JRA-224:"
git rm --cached file.text (remove file from version control)

Links
https://agilewarrior.wordpress.com/2016/09/10/how-to-setup-new-ios-workflow/
http://stackoverflow.com/questions/7244321/how-to-update-a-github-forked-repository
https://agilewarrior.wordpress.com/2017/03/17/how-to-write-a-git-commit-message/
https://github.com/rowanj/gitx

Tools

GitX

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: