Qt and Git
-
wrote on 11 Jun 2013, 03:22 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.
-
wrote on 11 Jun 2013, 04:04 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
$ git config --global user.name "Firstname Lastname"
$ git config --global user.email "your_email@youremail.com"- start git in project directory:
$ git init
- check project status
$ git status
- add files for git tracking
$ git add .
or
$ git add -u
(remove deleted files)- take a snapshot of the tracked files
$ git commit
or
$ 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
v0.1
v1.3
v1.4@
-
wrote on 11 Jun 2013, 08:18 last edited by
Don't forget
@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
@git rebase@
usually when you push to a remote repo which has advanced and you don't want to merge but ff.I suggest
http://nvie.com/posts/a-successful-git-branching-model/What might be helpful, too, here's my general .gitignore:
@# OS Related:*~
Thumbs.db
desktop.ini
.DS_StoreQt Related:
build-release/
build-debug/
-build--Release/
-build--Debug/
.pro.user
Makefile*
moc_.cpp
qrc_.cpp
ui_*.h
*.log
*.qch
*.qm
*.ts
*.autosave
*.mocCompilation Binaries:
*.o
*.ar
*.gz
*.bz2
*.xz
*.tar
*.a
*.so
*.lib
*.dll
*.exe@
more specialized gitignores are in subdirs where necessary.My .gitattributes is
@* text=auto*.cpp text
*.h text
*.txt text
*.html text
*.xml text
*.css text
*.sh text
*.py text*.png binary
*.jpeg binary
*.jpg binary
*.bmp binary@
(prevents windows users from messing up newlines with their crazy \r\n)
1/3