background preloader

Git

Facebook Twitter

Quick Tip: How to Work with GitHub and Multiple Accounts | Nettuts+ - Vimperator. So you have a personal GitHub account; everything is working perfectly. But then, you get a new job, and now need to have the ability to push and pull to multiple accounts. How do you do that? I'll show you how! Prefer a Screencast? Choose 720p for the best picture. Step 1 - Create a New SSH Key We need to generate a unique SSH key for our second GitHub account. Be careful that you don't over-write your existing key for your personal account. Step 2 - Attach the New Key Next, login to your second GitHub account, browse to "Account Overview," and attach the new key, within the "SSH Public Keys" section.

Next, because we saved our key with a unique name, we need to tell SSH about it. Step 3 - Create a Config File We've done the bulk of the workload; but now we need a way to specify when we wish to push to our personal account, and when we should instead push to our company account. If you're not comfortable with Vim, feel free to open it within any editor of your choice. Step 4 - Try it Out. A few git tips you didn't know about. Notice: some of these commands or flags require git version 1.7.2. On OS X, upgrade easily with Homebrew: brew install git Show branches, tags in git log $ git log --oneline --decorate 7466000 (HEAD, mislav/master, mislav) fix test that fails if current dir is not "hub" 494a414 fix cherry-pick of a commit URL 4277848 (origin/master, origin/HEAD, master) whoops d270fae bugfix: git init -g 9307af3 test deps 8ccc17e 64bb19c bugfix: variable name 546726a dont need you 3a8d7af (tag: v1.3.1) v1.3.1 197f429 (tag: v1.3.0) v1.3.0 a1e1a50 not important 3c6af16 magic `cherry-pick` supports GitHub commit URLs and "user@sha" notation Diff by highlighting inline word changes instead of whole lines $ git diff --word-diff # Returns a Boolean. def command?

This flag works with other git commands that take diff flags such as git log -p and git show. Short status output $ git status -sb M ext/fsevent/fsevent_watch.c ?? Push a branch and automatically set tracking. Extradite.vim: a git commit browser. Context Matters » Why I use git and puppet to manage my dotfiles. It’s no big secret that I love git (enough to give a talk on git and github ). So of course it is natural for me to control my various dotfiles using git. Now of course I’m not the only one who loves to use git to manage dotfiles so I won’t focus too much on the general git dotfile goodness but instead on my use of puppet. I use a central private github repository to store my dotfiles. I then check out this repository on all of my unix-like machines (mostly Linux and Mac OS X) as my ~/config directory. Then I symlink all my dotfiles into that directory. So instead of having a real ~/.bashrc file mine is just a link into my ~/config/my.bashrc file.

Of course if I only used the default master branch of git I may as well be storing all of my dotfiles in Dropbox . Managing all of these symlinks on a new machine can be quite a chore. So how can we use puppet fit to accomplish all of this? This is all you need to get started: This is really a very basic puppet configuration file. DVCS-Autosync: A personal Dropbox replacement based on Git | Rene Mayrhofer's virtual home. Executive summary dvcs-autosync is a project to create an open source replacement for Dropbox/Wuala/Box.net/etc. based on distributed version control systems (DVCS). It offers nearly instantaneous mutual updates when a file is added or changed on one side but with the added benefit of (local, distributed) versioning and that it does not rely on a centralized service provider, but can be used with any DVCS hosting option including a completely separate server - your data remains your own.

Synchronization of directories is based on DVCS repositories. Git is used for main development and is being tested most thoroughly as the backend storage, but other DVCS such as Mercurial are also supported. dvcs-autosync is comparable to SparkleShare in terms of overall aim, but takes a more minimalistic approach. A single Python script monitors the configured directory for live changes, commits these changes to the DVCS (such as git) and synchronizes with other instances using XMPP messages.

Download. Bramcohen: Git Can't Be Made Consistent. This post complains about Git lacking eventual consistency. I have a little secret for you: Git can't be made to have eventual consistency. Everybody seems to think the problem is a technical one, of complexity vs. simplicity of implementation. They're wrong. The problem is semantics. When you make a change in Git (and Mercurial) you're essentially making the following statement: This is the way things are now.

Which is subtly and importantly different from what a lot of people assume it should be: Add this patch to the corpus of all changes which have ever been made, and are what defines the most recent version. The example linked above has a lot of extraneous confusing stuff in it. In this example, one person changed a files contents from A to B, then back to A, while someone else changed A to B and left it that way.

Unfortunately, this decision comes at significant cost. A smaller problem, but one which seems to perturb people more, is that there are some massively busted edge cases. Git 201: Slightly More Advanced - Adventurous. Playing Git Like A Violin. People think that playing the violin is hard. But that’s only when you are learning and practicing. When you are actually playing, it’s as natural as breathing. So it is with Git. After a couple years of use, and the help of a few aliases, my git usage now comes as easily as music from a familiar piece: git caa git ca git s git l git r1 git rh 330183 git s git d git cm 'a new commit' All of us at one point or another kept a private cheat sheet of common git commands.

Very often, after I’ve made a commit, I’d keep wanting to make small fixes to it, like fussing around with spaces, or renaming variables, or rewording the comments, or minor refactoring of the code. Git commit -a --amend -C HEAD This adds all the changes to the staging area, and commit it as an amendment to the previous commit, using the same commit message. For this usage pattern, I have created an alias in my ~/.gitconfig, like so: [alias] caa = commit -a --amend -C HEAD git commit -a -m 'commit message'