Tips for Pro Git Users from 8 Open Source Project Leaders | Linux.Com
Total Page:16
File Type:pdf, Size:1020Kb
6/1/2015 Tips for Pro Git Users From 8 Open Source Project Leaders | Linux.com Linux Foundation Training Events Video ¬† ¬† ¬† ¬† ¬† search linux.com Home News Linux Community Learn Linux Directory Jobs Home News Featured Blogs Libby Clark Tips for Pro Git Users From 8 Open Source Project Leaders Tips for Pro Git Users From 8 Open Source Project Leaders Monday, 27 April 2015 13:31 Libby Clark | Exclusive In honor of the 10year anniversary of the Git revision control system this month, we talked to project leaders from eight open source projects as well as the tool's creator, Linus Torvalds. These hardcore Git users told us how and why they use the tool for open source software development, along with their favorite tips for using it like a pro. Below are their answers, combined into a handy list of hacks. Keep in mind that these tips aren't necessarily the only way to accomplish a given task, as Torvalds points out in his Upcoming Linux Foundation Courses th recent interview for the 10 anniversary. But they're the features and methods that project leaders have LFS201 Essentials of System Administration found most useful through the years. 12 Jan » 30 Mar Online SelfPaced “You can do a lot of things with git, and many of the rules of what you *should* do are not so much DETAILS technical limitations but are about what works well when working together with other people,” Torvalds LFD331 Developing Linux Device Drivers said. “So git is a very powerful set of tools, and that can not only be overwhelming at first, it also means that 01 Jun » 05 Jun Virtual (GUARANTEED TO RUN) you can often do the same (or similar) things different ways, and they all "work." DETAILS 1. Use Aliases LFD320 Linux Kernel Internals and Debugging Paolo Bonzini, a principal software engineer at Red Hat, QEMU contributor and maintainer of KVM: 08 Jun » 12 Jun San Jose CA + Virtual (GUARANTEED TO RUN) I have several "aliases" that simplify some git tasks. Here are the simplest of them: DETAILS changes = diff namestatus r View All Upcoming Courses diffstat = diff stat r whatis = show s pretty='tformat:%h (%s, %ad)' date=short 30 Linux Kernel Developers in 30 Weeks pwhatis = show s pretty='tformat:%h, %s, %ad' date=short Linux Kernel Developer Work Spaces Video: Stephane Graber, The two "r" haven't been necessary for several years, but those two aliases are 8 years old and I've never LXC bothered to update them! The "changes" name comes from Arch, a distributed version control system from Linux Kernel Developer Work Spaces Video: Tejun Heo, Red which I switched to git. Hat "whatis" and "pwhatis" convert a commit id to a format that can be pasted in an email. "pwhatis" is for Linux Kernel Developer Work Spaces, Unplugged (Video): John pasting inside parentheses, "whatis" works outside parentheses. When discussing a patch it helps a lot to Linville refer to past commits, and it's good to use a consistent format (id, subject, date). 30 Linux Kernel Developer Work Spaces in 30 Weeks: Jes 2. patch Sorensen Thiago Macieira, Qt Project core maintainer and software architect at Intel 30 Linux Kernel Developer Work Spaces in 30 Weeks: Shuah The patch options to git add, git checkout and git reset. Khan 3. Magit for Emacs users Alexandre Julliard, Wine Maintainer It's not for everybody, but for Emacs users, I strongly recommend Magit. I wrote the original git.el Emacs frontend, and used that for a few years, but it was never very good. I'm glad that people smarter than me have now tackled the problem, and Magit does a great job of making the full power of git accessible from Emacs. 4. Git describe Michael Stahnke, director of engineering services at Puppet Labs: Version your projects using `git describe`. If you use tags, you can use ‘git describe’ to version things when http://www.linux.com/news/featuredblogs/200libbyclark/826426tipsforprogitusersfrom8opensourceprojectleaders 1/3 6/1/2015 Tips for Pro Git Users From 8 Open Source Project Leaders | Linux.com doing scratch builds. We do this on nearly all of our projects in our build pipelines. It takes the guess work out of the build process and unlike just using a raw sha, it sorts properly. Tweets 5. Squash commits Alastair Montgomery 1m Nick Mathewson, Tor Director and Chief Architect: @bigboymademe I've attached a script I use to squash git commits without rebasing them. This makes the squash commits SourceForge locked in projects of fleeing users, cashed in on happen, but prevents (most) rebase conflicts. malvertising [Updated] 6. Use autocorrect ift.tt/1GhQ7FH #linux #news Show Summary Angie Byron, Drupal core committer and director of community development at Acquia: I am absolutely not a proGit user, so my favorite pro tip is: Alastair Montgomery 1m @bigboymademe git config global help.autocorrect 3 Ubuntu MATE Devs would to make like an Ubuntu MATE Basic Edition ...because I am a total butterfingers and always mistyping commands, like 'git pusj'. This trick makes Git From Wimpy's G+﴿ ift.tt/1dHSaGS﴾ just do what you meant, not what you said. :) #linux #news 7. Reorder and combine commits Show Summary Sage Weil, Ceph Creator and principal architect at Red Hat: Linux Driver Devel @driverdevel 4m The combination git gui’s ability to quickly stage and unstage lines or hunks into a commit and git rebase #linux #drivers [PATCH v2 4/4] i’s ability to reorder and combine commits is invaluable. This allows you to work with the history as a series Compose new Tweet… of patches and rearrange the content of those patches into a clean history for submission upstream. 8. Cherry pick changes Matthew Miller, Fedora Project Leader: Use 'git cherrypick' to pull individual changes from a different branch. When I first switched to git, I would create diffs and apply them each by hand; then, when I discovered that there's a much better way builtin, *mind blown*. In fact, I'd go so far as to generalize this: anytime you want to do something in git and it feels like the way you're doing it is a bit awkward and clunky, take some time to look for a builtin feature which handles it better. Read more Git anniversary stories: How to Run Your Own Git Server 7 Pro Tips For Using Git from Fedora Developers Git Success Stories and Tips from Wine Maintainer Alexandre Julliard Latest Featured Blogs Git Success Stories and Tips from Ceph Creator Sage Weil Our Top 10 Favorite Video Games (An Informal Poll) Git Success Stories and Tips from Puppet Labs' Michael Stahnke 10 Linux Dream Jobs What's Yours? Git Success Stories and Tips from Tor Chief Architect Nick Mathewson How and Why to Speak at Linux Foundation Events Git Success Stories and Tips from Drupal Core Committer Angie Byron Video: 84YearOld Volunteer Rebuilds, Sends Linux Laptops to Git Success Stories and Tips from Qt Maintainer Thiago Macieira Africa Git Success Stories and Tips from KVM Maintainer Paolo Bonzini A Request for Help from a Linux Community Member in Nepal 10 Years of Git: An Interview with Git Creator Linus Torvalds Libby Clark Sign Up For the Linux.com Newsletter First Name Last Name Email Country Subscribe View our Privacy Policy Comments Name : Email : http://www.linux.com/news/featuredblogs/200libbyclark/826426tipsforprogitusersfrom8opensourceprojectleaders 2/3 6/1/2015 Tips for Pro Git Users From 8 Open Source Project Leaders | Linux.com Comment : Subscribe to Comments Post Comment WHO WE ARE ? EXPLORE STAY CURRENT ABOUT LINUX.COM The Linux Foundation is a nonprofit Answers Netbooks How to Participate consortium dedicated to the growth of Blogs Cloud Computing Contact / About Linux. Forums Enterprise Advertise More About the foundation... Directory Embedded & Mobile Privacy / Terms / Editorial Policy Frequent Questions Join / Linux Training / Board Linux.com © 2015 Linux.com. All rights reserved. The Linux Foundation Symbol is a trademark of the Linux Foundation. Linux is a registered trademark of Linus Torvalds. http://www.linux.com/news/featuredblogs/200libbyclark/826426tipsforprogitusersfrom8opensourceprojectleaders 3/3.