Bhagavad Gita Chapter 8
Powerful Cognition
A person who understands the different paths a spirit can take while leaving the body will always be prepared for death. He immerses himself in devotion throughout his life so that he becomes liberated.
vedeṣu yajñeṣu tapaḥsu caiva dāneṣu yat puṇyaphalaṃ pradiṣṭam atyeti tat sarvam idaṃ viditvā yogī paraṃ sthānam upaiti cādyam
A person who accepts the path of devotional service is not denied the results derived from studying the Vedas, performing austerities and sacrifices, giving charity or pursuing pious and result based activities. At the end he reaches the supreme abode.