As you may well know, Git is the most popular source code management system with over 70% of developers using Git for their projects. But, how much do you know about Git’s functionality and what it can do to ease your workload? Let’s run through the top eight git commands many software engineers don’t know about.
1.Git branch -m old-name new-name
The first command helps you Rename Branches Locally. And if you want to rename the currently checked out branch, you can shorten this command on the following form: git branch -m new-name
2.Git diff –name-only –diff-filter=U | uniq | xargs $EDITOR
Rebasing has some risks, like the appearance of some conflicts in several files. Use this command to open all the files which have problems that need solving.
3.Git whatchanged –since=’2 week ago’
This command is quite useful to show the changes introduced by each commit from the last two weeks.
4.Git stash -p
Want to stash any part of any file? Just use this command. You can also use the –patch option to stash select parts of each tracked file.
5. Git cherrypick
Although this git command needs your working tree to be clean, it is still quite useful. You can apply the change of each current commit, recording a new commit for each.
6.Git gc –prune=now –aggressive
This is your ideal command if you’re looking to optimize the repository locally.
7.Git commit –amend
Modify the most recent commit by combining staged changes with the previous commit instead of creating a new one. It’s also useful for editing the previous commit message without changing its snapshot.
8.Git branch –contains <commit>
Do you want to know what happens once you know the commit? What versions are being affected by a bug? Just try this git command. It will show you all the branches that contain a particular commit.
Discover more Git commands here.
Experience Git on Plesk
Think of what could happen if you add Git as a layer onto Plesk – the simple site management platform. You can deploy your website content even easier by pushing it to a local Git repository or pulling from a remote one. Then, choose whether you want to deploy manually and get full control, or just enable automatic deployment and save time.
Get the option of creating different branches in one repository so that you can separate the staging code form the production code. You know – since Plesk lets you have a free staging environment with WP Toolkit. Also, you are free to choose your software engineering service – GitHub, BitBucket or Travis – all are fine while using Plesk’s Git extension.
2 Comments
I love the feature to deploy from git repository. A must-feature for developers that works with local environment.
Please add more git integrations!
Thanks for your support David!