user1990009
user1990009

Reputation: 965

GIT - Compile and Test Staging Area

I am using GIT and I am working on 2 tasks at the same time. Task 1 and Task2. Now I want to push to the server Task1. So I commit all related files of Task 1 (T1) to the staging area.

My Staging area its ready to be pushed to the server, but before doing this, I consider it would be safe to check if my staging area its compiling and passing the tests.

How can I get a working dir with the staging area only changes in order to compile it and run the automated tests?

Note I dont want to run tests of the working directory, only of the staging area...Because working dir has changes related from T1 and T2.

Upvotes: 10

Views: 1070

Answers (3)

Mark Leighton Fisher
Mark Leighton Fisher

Reputation: 5693

You could git stash save to save all of your non-related changes into a stash, run your tests, then restore the non-related changes with git stash pop. (If it were me, I would first read man git-stash to ensure I got all of the steps in the right order.)

Upvotes: 7

xero
xero

Reputation: 4319

i have a similar project. i use branches to achieve this. i created a src branch and code there. once everything seems ok i commit then branch off that point to a bin branch. if compiling works i commit it. then i merge the src branch into master. this methodology keeps the master branch clean with only known working code. and keeps the dev code and compiled files in their own autonomous branches (which i never push).

Upvotes: 0

Brian Agnew
Brian Agnew

Reputation: 272247

This sounds to me like you should be using git branches. Each of your tasks would be developed on a separate branch and you can push one before the other, and merge up from the first completed branch (task) to the second.

See here for more details.

Upvotes: 3

Related Questions