0

I'm trying to store my project on github using Force.com IDE Tool (ant). I have created a new command to store my project on github defining it in the build.xml file:

<macrodef name = "git">
    <attribute name = "command" />
    <attribute name = "dir" default = "" />
    <element name = "args" optional = "true" />
    <sequential>
        <echo message = "git @{command}" />
        <exec executable = "git" dir = "@{dir}">
            <arg value = "@{command}" />
            <args/>
        </exec>
    </sequential>
</macrodef>

<target name="initGit">
    <git command="config" dir="retrieveUnpackaged">
        <args>
            <arg value="--global"/>
            <arg value="user.name"/>
            <arg value="'Dark, Skull'"/>
        </args>
    </git>

    <git command="config">
        <args>
            <arg value="--global"/>
            <arg value="user.email"/>
            <arg value="'myemail@email.com'"/>
        </args>
    </git>
</target>



<target name="retrieveDeployVersioning">
    <mkdir dir="retrieveUnpackaged"/>

    <sf:retrieve username="${sf.source.username}" password="${sf.source.password}" sessionId="${sf.sessionId}" serverurl="${sf.source.serverurl}" maxPoll="${sf.maxPoll}" retrieveTarget="retrieveUnpackaged" unpackaged="unpackaged/package.xml"/>
    <sf:deploy username="${sf.destination.username}" password="${sf.destination.password}" sessionId="${sf.sessionId}" serverurl="${sf.destination.serverurl}" maxPoll="${sf.maxPoll}" deployRoot="retrieveUnpackaged" rollbackOnError="true"/>


    <git command="init"></git>
    <git command="add">
        <args>
            <arg value="--all"/>                
        </args>
    </git>
    <git command="commit">
        <args>
            <arg value ="-m 'Initial Commit'"/>
        </args>
    </git>
    <git command="remote">
        <args>
            <arg value="add"/>
            <arg value="origin"/>
            <arg value="https://github.com/test-versioning.git"/>
        </args> 
    </git>
    <git command="push" dir="retrieveUnpackaged">
        <args>
            <arg value="-u"/>
            <arg value="origin"/>
            <arg value="master"/>
        </args>
    </git>
</target>

All works great, but I want to update my package.xml incrementally and I don't want to overwrite everytime I push it.

How can I maintain the package.xml update with all the resource that I have uploaded?

  • I am not sure what you mean here. Are you trying to do something other than update your package.xml in your git repo with the content from your local file? – dsharrison Nov 6 '17 at 16:42
  • Yes, I would merge all the build.xml fiels that I received. – DarkSkull Nov 6 '17 at 16:43
  • I think you want to take a bit of time.to walk through the basics of how git versions files to get a better understanding of what happens when you make a commit. git-scm.com/book/en/v1/Getting-Started-Git-Basics – dsharrison Nov 6 '17 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.