Unix-shell-tricks-for-Qt-development: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Here are some aliases and tools that can be useful in a shell session on Linux or Mac <span class="caps">OSX</span> (or Windows if you are using the version of bash that comes with the git installation).
#REDIRECT [[Unix shell tricks for developing Qt]]
 
=git-prompt.sh=
 
Many distribution packages of git include this shell script, possibly /usr/share/git. It may or may not be installed in such a way that it gets parsed in every new login shell; if not, you can add to your own ~/.bashrc
 
It will create some bash command completions, so you can e.g. type “git l&lt;tab&gt;” to complete the “git log” command. It also defines __git_ps1, which can be used as part of your customized shell prompt (preferably including <span class="caps">ANSI</span> colors, the time, current directory, the Qt version currently chosen for qtchooser, etc.); you can test it like this
 
The output means that I’m on “dev” branch and have committed all of my local changes which have not yet been integrated. However, this can slow down your shell when changing directories, because quite some disk activity is necessary to generate that single final character of status.
 
=Aliases=
 
These are my favorites so far:
 
is convenient for things like <code>git-foreach ‘git pull —rebase’</code> to update all submodules to the latest versions of their respective branches (but you could make another alias for that).
 
I use git-cleanall at the top of the repository cloned from qt5.git to ensure that there are no leftover object files before starting a clean build. However, it’s better to use shadow builds (run configure and make in a different directory so that the build output stays out of your source tree); the main reasons are that you can use one source tree to build debug and release builds (even for multiple platforms) separately, and your source tree is always clean. But sometimes I still build examples and tests in the source tree, selectively.
 
glog is for showing a short log of the last 10 changes, and highlighting the point at which your local changes diverge from the integrated changes that you got from the remote.
 
=Logging changes in all submodules at once=
 
For that I have a shell script, ~/bin/glogg, like glog but with an extra ‘g’ to indicate that it does more <span class="smiley">;-)</span> (<span class="caps">BTW</span> “gløgg” is also a nice Norwegian onomatopoeic word for warm, spiced wine, something like wassail; so using this command gives you a warm Christmas feeling.)
 
===Categories:===
 
* [[:Category:Developing with Qt|Developing_with_Qt]]
** [[:Category:Developing with Qt::Qt-5|Qt 5]]
* [[:Category:HowTo|HowTo]]

Latest revision as of 09:24, 10 March 2015