Git is a minimal and elegantly architected DVCS. However, its terrible user interface obscures its simple data model, making reasoning with git surprising and frustrating. Once you have learned git’s data model and a few commands to help you see what’s going on, most of the surprises and frustration go away. This workshop aims to give you the mental model you need to work with git and provide a foundation for a deeper understanding of the git toolkit.
git-crypt
(github) keeps your secrets safe in a git repository. It decrypts on checkout and encrypts at commit using standard git
hooks. Once configured, it is completely transparent.
I had a situation where the secrets were already in the repo and I needed to encrypt them (if you’re in this situation, you should also change your secrets because git log -p
).
To encrypt files (foo.conf
, bar.conf
) already in the repo:
Git has a nice feature called bisect
that’s immensely useful for finding out where and when something broke.
For this example, we’ll use small integers for commit ids because they’re easier to reason about and orderly. In reality, they’ll be long SHA hashes.
Let’s say you have a commit history like this:
commit 12
Author: Joe
commit 11
Author: Scott
commit 10
Author: Scott
commit 9
Author: Scott
commit 8
Author: Miles
commit 7
Author: Joe
commit 6
Author: Dave
commit 5
Author: Bob
commit 4
Author: Joe
commit 3
Author: Dave
Pretend you’re Dave (your last commit was commit 6) and you do a git pull
and an ‘install-dev’ and see that the site’s busted, CSS all over the place, whatever. Git bisect to the rescue. First, tell git you’re ready to have it help you find the problem:
Some notes about git
. As with all my technical posts, some or all of this may be out of date. Consider it, then, courage to believe that there may be a solution to your problem in terms you can understand.
I have a local repository I want to make into a remote repository
Here’s our local repository:
local $ git init .
local $ git add .
local $ git commit . -m "- initial commit"
Nice. Now make an empty repo on the remote server: