Archive

Archive for the ‘git’ Category

How can I change the author name / email of a commit?

December 3, 2018 Leave a comment

Problem:
I needed to change the email address for multiple commits.

Solution:
Followed the steps under this section in the source.

Using Interactive Rebase

Interactive Rebase is the Swiss Army Knife of tools in Git: it allows you to do and change almost anything. However, being as powerful as it is, this also means you can very easily shoot yourself in the foot. Use it with care (and possibly read up on it)!

Source:
https://www.git-tower.com/learn/git/faq/change-author-name-email

Advertisements
Categories: git, Interesting Tags:

pre-commit: A framework for managing and maintaining multi-language pre-commit hooks.

October 16, 2018 Leave a comment

Introduction

Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. By pointing these issues out before code review, this allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks.

As we created more libraries and projects we recognized that sharing our pre-commit hooks across projects is painful. We copied and pasted unwieldy bash scripts from project to project and had to manually change the hooks to work for different project structures.

We believe that you should always use the best industry standard linters. Some of the best linters are written in languages that you do not use in your project or have installed on your machine. For example scss-lint is a linter for SCSS written in Ruby. If you’re writing a project in node you should be able to use scss-lint as a pre-commit hook without adding a Gemfile to your project or understanding how to get scss-lint installed.

We built pre-commit to solve our hook issues. It is a multi-language package manager for pre-commit hooks. You specify a list of hooks you want and pre-commit manages the installation and execution of any hook written in any language before every commit. pre-commit is specifically designed to not require root access. If one of your developers doesn’t have node installed but modifies a JavaScript file, pre-commit automatically handles downloading and building node to run eslint without root.


https://pre-commit.com/

Categories: git, Interesting

Githooks

September 28, 2018 Leave a comment

Git hooks are scripts that Git executes before or after events such as: commit, push, and receive. Git hooks are a built-in feature – no need to download anything. Git hooks are run locally.

These hook scripts are only limited by a developer’s imagination. Some example hook scripts include:

* pre-commit: Check the commit message for spelling errors.
* pre-receive: Enforce project coding standards.
* post-commit: Email/SMS team members of a new commit.
* post-receive: Push the code to production.

https://githooks.com

Categories: git, Interesting

Tips for using a git pre-commit hook

September 26, 2018 Leave a comment
Categories: git, Interesting

How to Write a Git Commit Message

September 4, 2018 Leave a comment

The seven rules of a great Git commit message

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line
  6. Wrap the body at 72 characters
  7. Use the body to explain what and why vs. how

https://chris.beams.io/posts/git-commit/

Categories: git, Interesting

Multiple git user profiles

August 28, 2018 Leave a comment

Problem:
How to have two git user profiles on one machine?

Solution:
From stackoverflow.

Global config ~/.gitconfig

[user]
name = John Doe
email = john@doe.tld

[includeIf “gitdir:~/work/”]
path = ~/work/.gitconfig

Work specific config ~/work/.gitconfig

[user]
email = john.doe@company.tld
name = Nickname # If you do not want to use John Doe

Source:
https://stackoverflow.com/questions/4220416/can-i-specify-multiple-users-for-myself-in-gitconfig

Categories: git

Joe – A .gitignore magician in your command line.

March 14, 2016 Leave a comment

http://karan.github.io/joe/

A .gitignore magician in your command line. Joe generates .gitignore files from the command line for you.

joe

sample

Categories: git, Interesting, python Tags: ,