Git Tips And Workflows, Round 2: basics, stashes and submodules - be present now. You'd think I fired all my bullets with my previous round of curated tips, but no, I have plenty more.
The new year has just kicked off and I am happy to be back with more findings, shortcuts and workflows to enhance your git experience. I also humbly anticipate the optimizations and corrections that you guys will feed me back. I very much appreciate that. Before I dive in the next round let me also give you a second to open a tab for my older post on more advanced git aliases, if you haven't seen it already. Ready? Table Of Contents Find the root of the project Say your build script needs to know the root of your git repository. Git rev-parse --show-toplevel Which results in: To automatically cd into it you can of course type: Git: Twelve Curated Tips And Workflows From The Trenches - be present now.
My Evernote tech-tips folder and my Notational Velocity stash have been collecting a huge list of git tips, many of which I have to look up again and again.
Until I finally give up and create aliases for them (by the way you can find some of my more advanced git aliases explained in my previous post). I expect many git practitioners will find them useful as much as I do. Here we go, let's start from tiny and simple things first. Making 'git diff' wrap long lines This has been driving me mad for a while.
If you use less as default pager just type -S while viewing the diff to reenable wrapping in less. 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.
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. And you can have it by adding this to your aliases section: GitHub for Windows. Why aren't you using git-flow?
If you need tagged and versioned releases, you can use git-flow’s release branches to start a new branch when you’re ready to deploy a new version to production.
Like everything else in git-flow, you don’t have to use release branches if you don’t want to. Prefer to manually git merge --no-ff develop into master without tagging? No problem. However, if you’re working on a versioned API or library, release branches might be really useful, and they work exactly like you’d expect: $ git flow release start 0.1.0 Switched to a new branch 'release/0.1.0' Summary of actions: - A new branch 'release/0.1.0' was created, based on 'develop' - You are now on branch 'release/0.1.0' Follow-up actions: - Bump the version number now!
Bump the version number and do everything that’s required to release your project in the release branch. You’re still on master, so you can deploy before going back to your develop branch, which git-flow made sure to update with the release changes in master. Git: Configure HTTP Proxy. How To Install A Public Git Repository On A Debian Server. Git is a free distributed revision control, was initially created by Linus Torvalds for Linux kernel development.
It is primarily developed on Linux, but can be used on other Unix operating systems including BSD, Solaris and Darwin. Git is extremely fast on POSIX-based systems such as Linux. It differs from svn and creates a private repository on a remote server too. Some popular projects using Git: * YUI * Merb * DragonFly BSD * GPM * Git * Linux Kernel * Perl * Gnome * Ruby on Rails * Android * Wine * Fedora * X.org * VLC * Prototype Well, we'll focus on how to install git and gitweb on the Debian distribution. gitweb is a git web interface written in Perl, and can be used as a CGI script or as mod_Perl, and it will allow us browsing a git repository. Getting git and gitweb packages from the Debian repository with aptitude:
Offbytwo Videos on blip.tv. Git Reference. Gitcore-tutorial - A git core tutorial for developers. The Perfect Work-flow with Git, GitHub, and SSH. Introduction to Git with Scott Chacon of GitHub.