1
votes

I have created VSTS build job using ANT. I have performed following steps.

  1. Pulled everything from my Production Environment using retrieve functionality through ANT.
  2. Set up Source Control with production code using GIT in VSTS successfully.
  3. Created DEVELOP branch for development and changes.
  4. Commit and Pushed all the changes to develop branch.
  5. Now my source folder "src" of develop branch has everything means (Production + Develop changes)

I tried to run build against one of the sandbox using develop branch but limited Package.xml having components those are changed in development.

Getting following Error.

BUILD ISSUE

Now the thing is I know everything is in my develop branch but very specific package.xml is defined because I want to deploy specific components not all.

Any help to solve this issue?? Or anyway where we can PULL the source/FILE/Component by mentioning the commit id like from this commit onward etc.

1

1 Answers

0
votes

Or anyway where we can PULL the source/FILE/Component by mentioning the commit id like from this commit onward etc.

You can clean the working directory of the git repo firstly, and then get the changed files after a certain commit. Finally, checkout the changed files in git working directory, so that only the changed files are kept in git repo.

Detail steps as below:

  1. Clean all the files of the working directory in git repo

    git rm -rf .
    
  2. Get the changed files after a certain commit

    git diff <commit> <current branch name> --name-only
    
  3. Get the changed file into working directory

    git checkout HEAD -- <filename>
    

Assume you want to keep the files which changed on develop branch only (after master branch at commit 4c671), then the example shell script as below:

git rm -rf .
for t in $(git diff 4c671 develop --name-only) 
do
{
  echo "changed file $t"
  git checkout HEAD -- $t
}
done

Or

git rm -rf .
for t in $(git diff master develop --name-only) 
do
{
  echo "changed file $t"
  git checkout HEAD -- $t
}
done