Create a directory mkdir ~/.aws Initialise git repository cd ~/.aws && git init Create a git branch with a name you want (e.g. development for the aws development account credentials).
...you want to manage a new account you just have to add a new git branch. Add this to your bashrc: export EC2_PRIVATE_KEY=~/.aws/pk-ec2.pem export EC2_CERT=~/.aws/cert-ec2.pem...
Git is hard: screwing up is easy, and figuring out how to fix your mistakes is fucking impossible. Git documentation has this chicken and egg problem where you can't...
It's like a GUI for the famous git add [-p]. Select files with the up/down-keys and hit u for staging/unstaging the whole file Enter for showing the diff of...
By default git diff highlights whole lines as changes. To diff on a word-by-word basis you can say: git diff --color-words To diff on a character-by...
...character basis you can say: git diff --color-words...
As described by the linked Stackoverflow answer, run these commands: sudo add-apt-repository ppa:git-core/ppa -y sudo apt-get update sudo apt-get install git
...This will get you Git 2.6.4 (as of Dec 2015). Troubleshooting If you don't have add-apt-repository yet, install it with: sudo apt-get install python-software-properties...
...this command to list the authors of the most recent commit of each branch: git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n
Git commands tend to come in groups. Avoid typing git over and over and over by running them in a dedicated git shell. You might want to run git config...
...global help.autocorrect true before using gitsh. This will silently swallow a muscle-memory "git" prefix to your commands inside the git shell...
When we started using git to manage our source code at work, we actually jumped in a little bit too fast. It seems like there is a lot of writing...
...about how you can do lots of really neat things with git, but no real guide about one particular way of using git for your project. This post is going...
tmp/* storage/* db/*.sqlite3 db/schema.rb db/structure.sql public/system .project .idea/ public/javascripts/all* public/stylesheets/all* public/stylesheets/*.css config/database.yml *~ *#* .#* .DS_Store webrat-*.html
This will list all branches matching your query as input options for git checkout greckout ar 1) ar/cache-api-keys-1098 2) ar/add-categories-object-to-tv-show-1382...
...them into your local branches, etc. You can see the remote branches by saying git branch -r Or, if you want to see both local and remote branches, you can...
You can seriously speed up deployments with Capistrano when using a local git repository on the server you are deploying to. Simply add set :deploy_via, :remote_cache
...exclude, [ '.git' ] to your config/deploy.rb and Capistrano will create a clone in shared/cached-copy. This will be updated using git pull when deploying which transfers less bytes and is usually much...
Our gitpt script to generate git commits from Pivotal Tracker stories has been tweaked and polished and is now part of the geordi gem. Install the freshly released version...
...out which of your local commits are not on the remote server do this: git cherry -v The -v option prints out the commit messages. Without it you will see...
...only the SHA1 codes. You may also compare against another (upstream) branch like that: git cherry -v origin/somebranch This tool is especially useful when you have a ton of commits...
...can change how many lines are shown above and below a changed section. E.g. git diff -U10 will show 10 lines above and below...
For every commit you need to revert, starting at the most recent, do: git revert -n [COMMIT] #revert, but don't automatically commit ... #fix any conflicts git reset #unstage...
git add -p #this will ask you for every change, whether you want to go through with the revert (i.e. "y" will revert, "n" will not; "?" for help...
While git branch will show you all branches and highlight the current one with an asterisk, it can be too cumbersome when working with lots of branches.
...the branch you are currently on, use: git rev-parse --abbrev-ref HEAD
...per default – you may change this, but it won't work for all programs), git won't recognize when you change the casing of files in your repository. Workaround
Random list of useful git commands for advanced users. I found some of them useful...
...the following will run all modified or new Cucumber features by looking at your git status: git status --short | grep -v '^ D ' | grep '.feature' | sed 's/.. //' | tr '\n' ' ' | xargs geordi...
Quick introduction to git internals for people who are not scared by words like Directed Acyclic Graph. The linked page offers a simple yet concise explanation of how git is...
...a simple diagram, so you get a sound understanding of how each command affects git's structure...
A nice way to stage absolutely all changes (edits, additions, deletions):
If you recorded a bad fix for a conflict, you can tell git to forget that bad resolution: git rerere forget your_file.rb Afterwards, the badly resolved file will still be...
...in your working directory. To get it back with confict markers, say: git checkout -m your_file.rb Resolve the conflict again, properly now...
This is called "cherry-picking". git cherry-pick commit-sha1 Note that since branches are nothing but commit pointers, cherry-picking the latest commit of a branch is as simple...
git cherry-pick my-feature-branch Be aware that cherry-picking will make a copy of the picked commit, with its own hash. If you merge the branch later...