etaanyapi tu karmaani sangam tyaktvaa phalaani cha |
kartavyaaneeti me paartha nishchintam matamuttamam || 6 ||

But, even those actions should be performed, giving up attachment and rewards. This, O Paartha, is my definite and foremost conclusion.
etaani : those
api : even
tu : but
karmaani : actions
sangam : attachment
tyaktvaa : giving up
phalaani : rewards
cha : and
kartavyaani : should be performed
iti : this
me : my
paartha : O Paartha
nishchintam : definite
matam : conclusion
uttamam : foremost
Shri Krishna says that the only way to convert selfish actions into selfless actions is to give up attachment to the action and to the rewards of the action. Consider an architect who spends months creating the plans for a building. If the architect designs the building keeping the bonus payment in mind, he is performing the action with an attitude of selfishness. If the architect designs the building with the sole motive of creating the best possible living space for people, he is performing the action with an attitude of selflessness.
Let us be clear about one thing. There is nothing wrong in the architect expecting a fair payment for the rendering of his services. But he does not keep a monetary expectation every second of his time while designing his buildings. He does it out of a sense of duty. His svadharma, which means his aptitude, his training and his passion, is to be an architect. Regardless of how his day goes, he derives joy in the performance of his svadharma, his duty to the world, as an architect.
In addition to giving up attachment to the reward of action, Shri Krishna also advises us to give up attachment to the action itself. Here, we have to keep two things in mind. First, it is not guaranteed that every action of ours will be successful, since there are external factors that may intervene. Second, even if we insist that an action should be performed in a certain way, there could be other ways that could sometimes work better. Insisting that every action ends successfully, and that every action has to be done our way, are the two ways in which we get attached to action. Giving up these attachments, along with the attachment to reward, is the only way that we get bring the purifying effect of karma yoga into every action we perform. This is Shri Krishna’s foremost conclusion on karma yoga.