When it comes to software packages, your system needs git and curl. For this article I decided on using Fedora, running as a virtual machine. Fancy-git works on all Linux distributions, so pick whichever you prefer. A little preview: What do you needįor starters you of course need a Linux system. This tutorial shows you how to install fancy-git, for showing the name of the Git branch and its status in your Bash terminal prompt. On top of that, it can even show you when commits still need to be pushed to the remote origin. Furthermore, it colors the text and background of the branch name to indicate its status: All clean, changes detected and files staged and ready to commit. It adds the name of the Git branch that you work on, to the Bash prompt. I catch myself typing git status often, just to see what branch I am on. When performing these operations, it’s easy to loose track of the branch you are working on. More often in a feature branch, which then needs to be merged back into the main branch. Consequently, I work a lot with Git in the terminal. I estimate that about ninety percent of the software development projects that I work on, use the Git version control system. I personally chose the direction of working with both Git and SVN in the terminal.įast forward a few years to today. That leaves you with two options: Either learn to work with Git and SVN directly in the terminal or find a good GUI tool for Linux. Under Linux, no fully functional ports of these tools exist, unfortunately. When developing software under Windows, I got used to convenient tools such as TortoiseGit and TortoiseSVN, for working with version control repositories. Most importantly, it shows the name of your Git branch in your Bash terminal prompt. It makes it possible to theme your Bash terminal prompt in a Git specific way. There’s got to be an easier way, right? Luckily there is: fancy-git. Normally, I would need to create the branch before I could check it out, but in newer versions of git, it's smart enough to know that you want to checkout a local copy of this remote branch.Catch yourself typing git status a lot? Yeah, me too. To switch to this branch, I can simply run: git checkout my-bugfix-branch Now git knows about my new my-bugfix-branch. * my-bugfix-branch -> origin/my-bugfix-branchįirst, rewinding head to replay your work on top of it.įast-forwarded master to 4316d296c55ac2e13992a22161fc327944bcf5b8. It will display an output that looks something like this: From :andrewhavens/example-project This will fetch all of the remote branches and merge the current branch. If I want to fetch the remote branches, I simply run: git pull My usual workflow is a little different now. I've learned a lot and git has improved since then. Update: It's been 5 years since I originally posted this question. The latter will create a branch that is also set to track the remote branch. Or you can do: git checkout -t origin/branch-name git checkout -b newlocalbranchname origin/branch-name Thanks to a related question, I found out that I need to "checkout" the remote branch as a new local branch, and specify a new local branch name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |