summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Widen <andreas@harmonicflow.org>2016-02-16 18:17:54 +0100
committerAndreas Widen <andreas@harmonicflow.org>2016-02-16 18:17:54 +0100
commit89cad5c43ee2a0e6c22328fe2d15854c77afe959 (patch)
treea73c396c544feec29263f2195155fdb685eb531a
parent16bb8f842120be069961b0235eb9b1ed1899ab07 (diff)
downloadHarmonicFlowOrgWeb-89cad5c43ee2a0e6c22328fe2d15854c77afe959.tar.xz
HarmonicFlowOrgWeb-89cad5c43ee2a0e6c22328fe2d15854c77afe959.zip
New blog post: Git Basic Setup.
Signed-off-by: Andreas Widen <andreas@harmonicflow.org>
-rw-r--r--blog/data/2016-02-16-17:38:40-git-basic-setup.txt166
1 files changed, 166 insertions, 0 deletions
diff --git a/blog/data/2016-02-16-17:38:40-git-basic-setup.txt b/blog/data/2016-02-16-17:38:40-git-basic-setup.txt
new file mode 100644
index 0000000..b305b92
--- /dev/null
+++ b/blog/data/2016-02-16-17:38:40-git-basic-setup.txt
@@ -0,0 +1,166 @@
+Title: Git Basic Setup
+Tags: git-tutorial, git-basic-setup
+Date: 2016-02-16 17:38:40
+Format: markdown
+
+## Installation
+
+First up, you should download and install Git for your preferred Operating
+System:<br>
+[http://git-scm.com/downloads](http://git-scm.com/downloads)
+__CUT__
+
+## First Time Setup
+
+Now that you have Git on your system, you'll want to do a few things to
+customize your Git environment. You should have to do these things only once
+on any given computer; they'll stick around between upgrades.
+
+Git comes with a tool called **git config** that lets you get and set
+configuration variables that control all aspects of how Git looks and
+operates. These variables can be stored in three different places:
+
+> * **/etc/gitconfig** file: Contains values for every user on the system and
+all their repositories. If you pass the option --system to git config,
+it reads and writes from this file specifically.
+> * **~/.gitconfig** or **~/.config/git/config** file: Specific to your user.
+You can make Git read and write to this file specifically by passing the
+--global option.
+> * config file in the Git directory (that is, **.git/config**) of whatever
+repository you’re currently using.
+
+Each level overrides values in the previous level, so values in
+**.git/config** trump those in **/etc/gitconfig**.
+
+## Your Identiy
+
+Your user name and email address is important to setup because every Git
+commit uses this information:
+
+<pre>
+$ git config --global user.name "Your Name"
+$ git config --global user.email youremail@example.org
+</pre>
+
+## Your Signing Key
+
+Your signing key is useful if you want to do cryptographic signing. Read
+more about cryptography and signing here:<br>
+[https://www.gnupg.org](https://www.gnupg.org)
+
+<pre>
+$ git config --global user.signingkey 362B5F22
+</pre>
+
+## Your Editor
+
+Configure the default text editor that will be used when Git needs you to
+type in a message. If not configured, Git will use system default editor.
+
+<pre>
+$ git config --global core.editor vim
+</pre>
+
+## Useful Git Aliases
+
+If you don’t want to type the entire text of each of the Git commands, you
+can easily set up an alias for each command. Here are a couple of aliases I
+personally use:
+
+<pre>
+$ git config --global alias.st status
+$ git config --global alias.co checkout
+$ git config --global alias.br branch
+$ git config --global alias.up rebase
+$ git config --global alias.ci "commit -s"
+$ git config --global alias.lp "log -p"
+$ git config --global alias.lod "log --oneline --decorate"
+$ git config --global alias.lg "log --graph"
+$ git config --global alias.lpo "log --pretty=oneline --abbrev-commit --graph --decorate --all"
+$ git config --global alias.l1 "log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
+$ git config --global alias.l2 "log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
+</pre>
+
+## Misc useful settings
+
+Tells Git if the executable bit of files in the working tree is to be honored.
+<pre>
+$ git config --global core.filemode true
+</pre>
+
+Controls which merge tool is used.
+<pre>
+$ git config --global merge.tool vimdiff
+</pre>
+
+Controls which diff tool is used.
+<pre>
+$ git config --global diff.tool vimdiff
+</pre>
+
+Mailing off a set of patches to a mailing list can be quite neatly done by
+**git send-email**. This setting is for that specifically. I'm personally
+using a neat program called **msmtp** for this.
+See [http://msmtp.sourceforge.net/](http://msmtp.sourceforge.net/) for more
+information.
+
+<pre>
+$ git-config --global sendemail.smtpserver /usr/bin/msmtp
+</pre>
+
+Set it to **always** if you want all output not intended for machine
+consumption to use color, to **true** or **auto** if you want such output to
+use color when written to the terminal.
+
+<pre>
+$ git config --global color.ui true
+</pre>
+
+Enable the reflog.
+
+<pre>
+$ git config --global core.logallrefupdates true
+</pre>
+
+## Checking your settings
+
+Use the following command to check all your settings:
+
+<pre>
+$ git config --list
+user.name=Your Name
+user.email=youremail@example.org
+user.signingkey=362B5F22
+alias.st=status
+alias.co=checkout
+...
+</pre>
+
+Use the following command to check a specific setting:
+
+<pre>
+$ git config user.name
+Your Name
+</pre>
+
+## Recommended reading
+
+The Git Reference docs explain everything about Git with really clear
+examples:<br>
+[http://gitref.org/index.html](http://gitref.org/index.html)
+
+For the most direct and complete information on each command:<br>
+[http://www.kernel.org/pub//software/scm/git/docs/](http://www.kernel.org/pub//software/scm/git/docs/)
+
+Amazing and simple tutorial that teaches you everything you need to know
+about using Git:<br>
+[http://rogerdudler.github.com/git-guide/](http://rogerdudler.github.com/git-guide/)
+
+Download the 'Git cheatsheet' and keep it handy:<br>
+[http://rogerdudler.github.com/git-guide/files/git_cheat_sheet.pdf](http://rogerdudler.github.com/git-guide/files/git_cheat_sheet.pdf)
+
+See [Git Basic Usage](/blog/git_basic_usage.php) for a tutorial on how to
+use Git.
+
+See [How to submit a patch](/blog/how_to_submit_a_patch.php) for a tutorial
+on how to submit a patch using Git.