Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 245
user1990009 Avatar asked Jan 18 '13 10:01

user1990009


2 Answers

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.)

like image 93
Mark Leighton Fisher Avatar answered Sep 30 '22 19:09

Mark Leighton Fisher


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.

like image 26
Brian Agnew Avatar answered Sep 30 '22 19:09

Brian Agnew