Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt and Git
Logical1 last edited by
I'm new to both Qt and Git, so this question could easily go on a newbie git form.
What files should I be tracking in my project? The obvious answer is anything I want backed up; however, do I need all these extra files or just my code?
For example, when I create a project Qt makes three directories: ProjectDir, ProjectDir-build, and ProjectDir-debug.
Do I need to track all three of these directories? Or can I just track the main dir that has the .pro file, all my .cpp and .h files?
This is my first Qt project, and first time using git. Any advice would be nice.
john_god last edited by
Just use git for your your ProjectDir, you don't need to use git in the other directories.
If you find usefull, here is a cheat sheet of most comun 12 git comands I use.
@Sets the name of the user for all git instances on the system
- start git in project directory:
$ git init
- check project status
$ git status
- add files for git tracking
$ git add .
$ git add -u
(remove deleted files)
- take a snapshot of the tracked files
$ git commit
$ git commit -m "comments about the commit"
- check info about the commits
$ git log
- check branchs in the project, at the beginning there will only be one, the master
$ git branch
- create a new branch called authorization
$ git branch authorization
- change to the new branch
$ git checkout authorization
- Do the merge from branch authorization with the branch master
Note: We should be in the master branch
$ git merge authorization
- Now we can delete the authorization branch
$ git branch -d authorization
- Create tags
$ git tag -a v1.4 -m 'my version 1.4'
- Show all tags
$ git tag
DerManu last edited by
@git merge --no-ff@
ff stands for fast-forward.
for merging topic branches when the dev hasn't advanced yet (or hotfix branches when the master hasn't advanced).
and of course
usually when you push to a remote repo which has advanced and you don't want to merge but ff.
What might be helpful, too, here's my general .gitignore:
@# OS Related:
more specialized gitignores are in subdirs where necessary.
My .gitattributes is
(prevents windows users from messing up newlines with their crazy \r\n)