Git commit to origin/master

Added by Ben Lipman over 1 year ago

I need to replicate the mechanism we have in TFS. The build server increments the semantic version in a header file (1.0.0.1313) then on success, it needs to commit this change back to the same branch it came from so everyone has the new version.

As of 1.8.5, I only see this mechanism commiting to a new tag and no one gets the change without someone merging this commit back into main branch.

These are the commands coming from the git source control block.

    <sourcecontrol type="filtered">
      <sourceControlProvider type="git" 
                            autoGetSource="true" 
                            >
        <executable>"c:\program files\git\cmd\git.exe"</executable>
        <repository>ssh://git@bitbucket.org/something.git</repository>
        <branch>DEV/V.NEXT</branch>
        <tagOnSuccess>true</tagOnSuccess>
        <commitBuildModifications>true</commitBuildModifications>
        <commitUntrackedFiles>false</commitUntrackedFiles>
        <tagCommitMessage>CCNet Release v{0}</tagCommitMessage>
        <tagNameFormat>v{0}</tagNameFormat>        
      </sourceControlProvider>
      <inclusionFilters>
        <pathFilter>
          <pattern>**/PROGRAM/**</pattern>
        </pathFilter>
      </inclusionFilters>
      <exclusionFilters>
        <commentFilter>
          <pattern>CruiseControl.NET .*</pattern>
        </commentFilter>
      </exclusionFilters>
    </sourcecontrol>
git checkout origin/master #results in a detached HEAD, no local branches
###build,edit version.h, etc####
git commit --all --allowempty -m "CCNet Release v1.0.0.1314" 
git tag -a -m "CCNet Release v1.0.0.1314" v1.0.0.1314
git push origin tag v1.0.0.1314

This does not get the changes in the remote master branch.