In season 1, episode 15 (Out of Time), we see a time loop in the end.
Assuming the timeline when the episode started to be x, in the end, we get to timeline x+1.

So, does Barry retain his consciousness of timeline x when in timeline x+1? If yes, then did Barry of timeline x have the memories of timeline x-1 when he saw a speed mirage? If so, why didn't he stop the events of timeline x from happening?

We'll have to wait until the next episode to be sure, but here's my guess: Barry didn't go fast enough in timeline x-1 to fully transition to timeline x as we see at the end of the episode. However, seeing the speed mirage may have changed something and allowed him to run fast enough fully transition from timeline x to timeline x+1.
– LiesmithMar 19 '15 at 1:01

I believe he didn't travelled in future , instead in past. So he moved from x to x - 1.
– PantherApr 20 '15 at 4:17

2 Answers
2

No. He could't transfer his memories to the previous flash even if he wanted to.

The previous flash and the next flash were totally different as seen in the episode. Initially we could see that the flash was travelling in the right (R) as seen from our perspective. But finally when the wormhole was created, we see the new flash come by the left (L), catching up to the original flash (R).

The reason they both saw what happened to be speed mirages (see below) was that when both the flashes saw each other, they were surprised and hence they drifted into parallel universes. The original flash (R) reverted back to his original universe whereas the new flash (with his memories) drifted away from the original universe and made a new universe. Hence the original flash could not get the memories of the previous timeline, because,

He will never have created the wormhole in the first place

The new flash was not the same as the original, because of the daily changes he encounters, like cellular changes.

The speed mirages were actually imprints left by each of the flash before being seperated, i.e. both of them actually existed for a moment before being seperated.

As explained in the following episode, Harrison Wells tells Barry that when you change details of the timeline, time has a way of correcting itself.

Even though Barry desperately wanted things to act the same as they happened in timeline x, but because he locks up Mark Mardon before the conclusion of timeline x the timeline now corrects itself as this did not happen in timeline x and thus becomes timeline x+1.

However Barry still retains his memories from timeline x as he time traveled from x to x+1.