If you hold a stock and sell it the holding period is based on when that lot was bought.
You do have to include the gain in income. The wash sale rule only applies to a loss so it does not matter if you buy the stock later in the same day.
If you hold a stock and buy more of that stock one day and then sell some shares later on that same day then you either use the default rule of selling the first shares you bought; or you can specify with the broker prior to the sale that you want to sell the stock you just bought on the same day. That would be a short term sale and the holding period on the stock you held prior to that day would continue.
Selling and then buying again is a sale to be reported for tax purposes and the holding period does start fresh for the newly purchased shares.
Please ask if you need more discussion or clarification.
Is it possible to avoid the long-term gain by selling short a stock if you have a long term position in that stock? That is, if I have shares of ABC in one account and sell ABC short in another and then cover in a few days, do I have to take gain on the long term position?