background preloader

Git Related

Facebook Twitter

How to move certain commits to another branch in git? Moves a folder from one git repo into another repo with history intact. Must Have Git Aliases: Advanced Examples - Be Present Now. Over the course of a few years I piled up a long list of git aliases.

Must Have Git Aliases: Advanced Examples - Be Present Now

This post will assume you know what aliases are and you have defined a few for yourself. I rely on many of them dozens of times a day. And maybe some have slipped your radar. Maybe you've never thought you could do some of these useful things with an alias. Let me show you some of the cool things you can do. You can add all the examples below to the [alias] section of your .gitconfig. To acquire the full list of my aliases you can check out my .gitconfig on Github. Explore your history, the commits and the code Shorten and beautify your log command because you will use it a lot. List commits in short form, with colors and branch/tag annotations. The Ultimate Git Alias Setup. The Ultimate Git Alias Setup If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands.

The Ultimate Git Alias Setup

It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory. Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them. I care, I share, I'm Nathan LeClaire. Developers like to pretend that we’re analytical and make decisions based purely on logic but the truth is that, like most people, we’re creatures of emotion and habit first and foremost.

I care, I share, I'm Nathan LeClaire.

We get superstitious sometimes, and in the face of the brain-crushing complexity of modern computing, who wouldn’t? One fear I’ve noticed is of git (in general) and in particular of git rebase. Indeed, previously I worked on a team where the mere mention of a rebase to the wrong team member could evoke howls of anxiety and protest. Feel free to share your own rebase experiences in the comments. Rebasing, like most of git, should be learned and applied to be useful - not feared or misunderstood - so if you’ve been bitten by rebase in the past, or are simply curious about how it can be used, hopefully I can persuade you here of its utility. From the man page: “git rebase: Forward-port local commits to the updated upstream head”.

If you’re still confused, let’s look at an example. Better Git configuration. I like Git.

Better Git configuration

I use it all the time. As I sometimes do, I recently took some time to really dig in, read through documentation, and review my global Git configuration. Welcome to my fourth stack improvements post! It’s all Git I started coding in the bad old days of plain filesystem copies and Visual SourceSafe with its exclusive locks on checkout. Later, at Cal Poly, I was exposed to Concurrent Versions System (CVS) as I worked on group projects.

During my Microsoft years, I used Team Foundation Server for source control during what we called “App Week,” where non-developers in Visual Studio would spend a whole week dogfooding the product to make sure it was ready to ship. Fall of 2010 was when things changed. Since then Git has truly taken off. It’s important to know, and to know well. Global config. Bob’s Blog - Git Bash Inside PhpStorm. Launch a floating Git bash window inside PhpStorm with a single click If you don't use Git and Jetbrains' fabulous editor, PhpStorm, this article probably won't interest you.

Bob’s Blog - Git Bash Inside PhpStorm

Likewise, if you use both and are used to using the Git features inside PhpStorm, this won't be much use to you, although you can do other things in Git Bash like using SSH connections, copying files, running Grep, or issuing Composer or Perl commands. Gitosis - git push says everything up-to-date even though I have local changes. Changing history, or How to Git pretty — justin hileman dot info. OpenSky’s engineering and product teams have an ongoing lunchtime presentation series called Lunch and Learn.

Changing history, or How to Git pretty — justin hileman dot info

A couple of weeks ago, I gave a talk entitled “Lunch and learn2git”. This article is an expansion on that presentation, and covers lessons learned from using Git in the open source community. Lesson one: Code is messy … what with all this branching. The above graph represents approximately a week of development in OpenSky’s primary repository. Swimlanes make sense of the chaos One of my favorite ways to wrap my head around development graphs like this comes from Vincent Driessen’s git-flow branching model. The full article is well worth a read. Git-flow At a high level, git-flow enforces a branching model with two primary branches: develop and production. So rather than worrying about the hundred-ish currently active branches in our repo, all I care about are three: develop, production and whatever feature branch I’m currently working in.

GitHub flow Pull requests Great! Revert, what? Changing history, or How to Git pretty — justin hileman dot info.