Archive

Archive for the ‘git’ Category

Mastering Markdown

February 27, 2019 Leave a comment

What is Markdown?

Markdown is a way to style text on the web. You control the display of the document; formatting words as bold or italic, adding images, and creating lists are just a few of the things we can do with Markdown. Mostly, Markdown is just regular text with a few non-alphabetic characters thrown in, like # or *.

https://guides.github.com/features/mastering-markdown/

Categories: git

Naming Branches

February 26, 2019 Leave a comment

Problem:
I was wondering if there is a convention for naming git branches. Though this really depends on what your organization has, what do you follow when there are no standards?

Solution:
After a quick google I opted to go for:

* feat-short-name
* test-short-name
* fix-short-name
* bug-short-name
* chore-short-name

When naming branches. Then still have

* develop for most of the work and
* master for releases.

Source:
https://github.com/agis/git-style-guide
https://stackoverflow.com/questions/273695/what-are-some-examples-of-commonly-used-practices-for-naming-git-branches

Categories: git Tags: ,

How to use `git mergetool` to resolve conflicts

February 18, 2019 Leave a comment

https://gist.github.com/karenyyng/f19ff75c60f18b4b8149

Have the following in .gitconfig

[merge]                                                                                                                           
    tool = vimdiff  
Categories: git Tags: ,

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

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