Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt and Git
Forum Update on Monday, May 27th 2025

Qt and Git

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Logical1
    wrote on 11 Jun 2013, 03:22 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      john_god
      wrote on 11 Jun 2013, 04:04 last edited by
      #2

      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"

      1. start git in project directory:

      $ git init

      1. check project status

      $ git status

      1. add files for git tracking

      $ git add .

      or

      $ git add -u
      (remove deleted files)

      1. take a snapshot of the tracked files

      $ git commit

      or

      $ git commit -m "comments about the commit"

      1. check info about the commits

      $ git log

      1. check branchs in the project, at the beginning there will only be one, the master

      $ git branch

      1. create a new branch called authorization

      $ git branch authorization

      1. change to the new branch

      $ git checkout authorization

      1. Do the merge from branch authorization with the branch master
        Note: We should be in the master branch

      $ git merge authorization

      1. Now we can delete the authorization branch

      $ git branch -d authorization

      1. Create tags

      $ git tag -a v1.4 -m 'my version 1.4'

      1. Show all tags
        $ git tag
        v0.1
        v1.3
        v1.4@
      1 Reply Last reply
      0
      • D Offline
        D Offline
        DerManu
        wrote on 11 Jun 2013, 08:18 last edited by
        #3

        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_Store

        Qt Related:

        build-release/
        build-debug/
        -build--Release/
        -build--Debug/
        .pro.user
        Makefile*
        moc_.cpp
        qrc_
        .cpp
        ui_*.h
        *.log
        *.qch
        *.qm
        *.ts
        *.autosave
        *.moc

        Compilation 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 Reply Last reply
        0

        1/3

        11 Jun 2013, 03:22

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved