In this episode, they guys talk with Phil Haack and Paul Betts (both new GitHubbers) and Keith Dahlby (author of posh-git, a set of PowerShell scripts which provide Git/PowerShell integration) about using Git on Windows.
Download / Listen:
- Paul begins with talking about why he thinks Git is cool, starting with the ability to create a clean source history that’s based on intent.
- Phil says some people who aren’t used to distributed version control get the wrong impression of rewriting history. The idea is that you’re rewriting history as you work locally to build a clean commit. You don’t generally rewrite history once you’ve pushed to the master repository.
- Keith says he tells people that when you push, it’s permanent. Until then, you can pretend you’re perfect. It’s just a save point – this reminds Jon of a quote from Dave Ward that this is like the ability to create save points anywhere in a video game.
- Scott K says this is all great in theory, but he never sees people taking advantage of history rewriting. He goes on to say that he loves GitHub but hates Git because Git hates developers – rewriting history is way too hard.
- Phil says that this makes more sense when you think of this in terms of replaying changes.
- Phil says that he really started liking Git after reading the site Think Like (a) Git.
- Paul says that he thinks this would be a lot easier to understand if you could see and work with things visually. Scott K says gitk kind of works but it’s clunky. Keith talks about gitk a bit more.
- Scott K talks about how he regularly ends up with a corrupted state and asks for recommendations. Paul says the solution is to use either git reset or git rebase and explains what they mean. Jon asks for more info, and Paul talks about git reset –hard.
- Phil talks about the importance of following an established workflow to avoid problems or getting in a state you don’t understand. He talks about the published workflow they use for the NuGet Gallery. Paul talks about how he and Phil are working on improving the interface to make it easy to follow working patterns.
- K Scott talks about one confusion is that there are so many commands and parameters. Keith says that you can get by with a tiny subset, and can grow as needed.
- Kevin asks if it’s possible to get your repository into a corrupted state, or if users are just getting confused by a valid state. Paul talks about some finer points of how things are stored and wraps up by saying really the only way to lose work with Git is to mess up or delete uncommitted changes or files.
- Twitter question from @LeeFlannery: "can you discuss how command line git for Win isn’t so scary – stop waiting for integrated VS tooling to use git." Paul talks about how the MSysGit makes things unnecessarily confusing by making you think you need to use the Bash prompt.
- Twitter question from @JavierLozano: "Why use powershell instead of bash for a console client? What are the gains?" Keith explains how posh-git gives you a Windows native experience (e.g. Windows style file paths). Phil talks about how the posh-git tab extensions give you an IntelliSense-ish experience with Git. Keith explains that posh-git does things like keeps track of which file have been added, so you can autocomplete files you’re adding rather than have to type them out.
- Scott K says that posh-git was slow when he tried to use it and asks if performance has been improved. Keith says that posh-git calls git status on every action to offer contextual tab expansions and explains how to disable that for faster performance.
- Keith talks about installing posh-git using psget, and more advanced use by cloning the posh-git repo and customizing it. Jon asks why installing posh-git in command-line didn’t work in the PowerShell ISE, and Keith explains that there are separate profiles for PowerShell command line, PowerShell ISE, and the NuGet Package Manager prompt in Visual Studio.
- Question from John Sheehan: "What are some of the other things outside of tooling that are impediments to Windows users adopting Git." Paul lists several: line endings, SSH keys, the MSysGit install, and the git commit using vi in compatibility mode.
- Keith says that MSysGit isn’t Git for Windows, it’s Git for Linux developers on Windows – it doesn’t behave like Windows at all. Keith asks who runs MSysGit.
- Phil says there are a lot of conceptual obstacles to adoption, and says that he thinks it’s necessary to make it easier to do simple things without worrying about obscure and advanced options.
- Jon talks about the frustrations in typing in the SSH passphrase and asks for suggestions. Paul talks about ssh-agent.
- Jon asks for specifics about what Paul and Phil are working on. Paul say the idea is similar features to GitHub for Mac – not necessarily in design, but featureset.
- Jon says that he likes how the TortoiseHg tooling shows the command-line version you could have typed when you perform operations in the GUI. Paul agrees that’s useful, and Keith points out that it’s available in Git Extensions.
- Scott K says that he likes the built in Mercurial server and says it’d be nice if Git made it easier to run a Git repo on Windows. Paul says that it’s really easy to set that using a fileshare. Scott K says he uses that, but it’s not as discoverable as the Mercurial webserver. Keith talks about how setting up he’s seen this set up using per-user shares.
- Twitter question from @jeremydmiller "Are you concerned that folks spend so much time debating and tweaking their Git workflow that they’ll forget to actually code?" Phil and Keith discuss two popular GitHub workflows: GitHub Flow and git-flow.
- Twitter question from @kppullin "why must line endings be so painful!" Paul explains the source of the problem and how autocrlf tries to solve that, and there’s a general about how problems occur.
- Keith talks about using gitattributes to do things like telling Git to use C# differencing with .cs files.
- Jon asks finding good, non-hostile documentation. Scott K says that all the books focus on happy path documentation rather than useful stuff. Some useful online resources are listed, including Think Like (a) Git, The Git Parable, and ProGit.org.
- Keith jokingly asks if we can talk about why Git is better than Mercurial. Jon takes the bait, and hilarity ensues.
- There’s a long discussion about the usefulness of a clean history and the ability to accurately use "blame" to understand when a bug was introduced.
- Things start to wrap up and K Scott asks for last thoughts. Paul mentions GitPad, which sets Notepad as your Git commit editor. Keith recommends Console2. Phil points out a neat hidden feature on GitHub – using T to get incremental search.