The rules say that a player must not improve or allow to be improved the position or lie of his ball, the area of his intended stance or swing, his line of play plus a reasonable extension beyond the hole or the area where he plans to drop or place a ball.
Pressing a club on the ground, moving, bending or breaking anything growing or fixed (i.e. immovable obstructions and stakes defining out of bounds), creating or eliminating irregularities of surface, removing or pressing down sand, loose soil, replaced divots or other cut turf and removing dew, frost or water are actions which could result in a penalty.
In the case of the latter two examples, a player can do either without penalty on the teeing ground. He can also remove loose sand and loose soil on the putting green.
Other actions permitted include grounding the club lightly when addressing the ball, making a stroke or in fairly taking a stance.
The significance of the word fairly is that it limits the player to what is reasonably necessary to take his stance in the least intrusive manner. It is OK to back into a branch or young sampling if that is the only way for him to take a stance for the selected stroke even if this causes the branch to move out of the way. The player is not entitled to a normal stance or swing, but only one that reasonable under the circumstances.
Knowing I could do this helped me win the Golf Writers of America Championship in 1975. I backed into a bush carefully and had just enough room with my feet right next to each other. A limited backswing with me facing away from the hole still enabled me to chip on the 18th green at The Dunes Golf Club in Myrtle Beach, S.C. and make my putt for birdie. This was when that hole played as a par 5.
A player can also play in any direction when fairly taking his stance.
A player could also bend a branch of a tree with his hands in order to get under it to play his shot. However, standing on a branch, hooking one branch to another, deliberately moving, bending or breaking branches to get them out of the way for a swing or with the stance when it could have been taken without doing so would not meet the definition of fairly taking a stance. So be careful!