עֵקֶב אֲשֶׁר שָׁמַע אַבְרָהָם בְּקֹלִי וַיִּשְׁמֹר מִשְׁמַרְתִּי מִצְוֹתַי חֻקּוֹתַי וְתוֹרֹתָי
Because Avraham heeded My voice, he observed My safeguards, My commandments , My decrees and My laws.
Rashi, based on Chazal, explains the different phrases in this verse as comprising the various components of the Torah’s mitzvos, reflecting the idea that that Avraham kept the mitzvos of the Torah even prior to it being given at Har Sinai to the Jewish People. This tradition is likewise assumed by the Rishonim to pertain also to Yitzchak and Yaakov, as well as their children. The understanding behind this idea is that even without being formally commanded regarding the mitzvos, the heightened spiritual sensitivity of the Avos enabled them to independently intuit what acts would be spiritually beneficial for them, as well as those which would be spiritually detrimental.
The commentators discuss the fact that, understandably, there are many mitzvos whose practical performance would not seem to have been relevant to the Avos. Additionally, they raise the specific question of Yaakov marrying Rachel and Leah, seeing as marrying two sisters is something that the Torah would in time prohibit. Nevertheless, as a matter of general principle – to whatever degree and in whatever way feasible – the Avos kept the mitzvos of the Torah.
Ramban: Home Rules
A very well-known position regarding this tradition is that of the Ramban, who states that it only applied when the Avos were in the Land of Israel. They perceived and recognized that life in Hashem’s Land intrinsically involves keeping the mitzvos of the Torah – regardless of whether they have been commanded yet or not. Outside of Israel, however, the Avos did not adopt this practice. With this, the Ramban offers his answer to the question of how Yaakov could marry two sisters, since he did so while he was living outside of Israel, in the land of Aram.
Counter Messages from the Midrash?
The Ramban proceeds to cite one statement of Chazal that appears to contradict his position, for the Midrash states that Yosef kept Shabbos even while he was in Egypt! To this, the Ramban responds by saying that this practice of Yosef was an exception, which he deemed necessary in order to instill the fundamentals of faith and monotheism within his children who were surrounded by the pagan society of Egypt. With regards to the other mitzvos, however, there was no notion of electing to keep them outside of the Land of Israel.
However, there is another statement of Chazal which the Ramban does not mention, which would appear to pose a much greater challenge his approach. Commenting on Yaakov’s words to Esav upon his return to the land, “עִם לָבָן גַּרְתִּי – I sojourned with Lavan,” the Midrash notes that the letters of the word “גַּרְתִּי” are identical with those of “תרי"ג,” the numerical value of the six hundred and thirteen mitzvos of the Torah, indicating that Yaakov kept them all even while with Lavan. Once again, with the above-mentioned proviso that that many of the taryag mitzvos could not be kept on a practical level etc., nevertheless, the Midrash indicates that, at least as a matter of principle, Yaakov was keeping the taryag mitzvos in Chutz La’aretz. This seems to directly contradict the Ramban’s position!
Harmony: Pshat and Remez
Perhaps we may suggest the following. The word “גַּרְתִּי” itself actually means “I sojourned”, indicating a short-term or transient stay. Let is ask: is there any connection between the pshat meaning of the word “גַּרְתִּי” itself and the gematria that Chazal attached to it denoting Yaakov’s fulfilment of the mitzvos? Perhaps it is revealing the reason why Yaakov kept the mitzvos while staying with Lavan. In reality, seeing as he was in Chutz La’aretz, there was no actual need to keep the mitzvos. However, since he regarded his stay with Lavan as temporary – as indicated by the word “גַּרְתִּי” – with the notion of his return to Eretz Yisrael firmly entrenched in his vision, he thus saw it as appropriate to continue his fulfilment of the taryag mitzvos even while outside the land, in order to maintain his familiarity and fluency with them for when he would ultimately return. It thus emerges that the allusion within the word “גַּרְתִּי” is in fact a product of its meaning on a pshat level!
Indeed, looked at in this way, not only can the above comment of the Midrash be reconciled with the Ramban’s approach, but it actually emerges as a support for it, for it specifically frames Yaakov’s observance of taryag within the context of the temporary nature of his stay in Chutz La’aretz. Without the “garti,” element in Charan, there may not have been “taryag” there either!
 Bereishis 26:5.
 See Yoma 28b and Bereishis Rabbah 64:4.
 R’ Yehoshua Heller, Beis Tefillah chap. 17.
 For a discussion of these questions, see e.g. Daas Zekeinim mi’Baalei HaTosafos, Bereishis 37:35, Maharsha Yoma loc. cit., Gur Aryeh Bereishis 46:10, Ohr Hachaim ibid. 49:3 and Nefesh Hachaim 1:21.
 Bereishis 26:5.
 See Bereishis Rabbah 92:4.
 Bereishis 32:5.
 Cited in Rashi ibid s.v. garti. See Torah Sheleimah ibid. sec. 31 who cites various sources in the Midrash where this comment appears.
 In this regard, this is a “pre-echo” of the words of the Sifrei in Parshas Ekev (sec. 43, cited in Rashi Devarim 11:18 s.v. ve’samtem, and discussed at length by the Ramban in Vayikra 18:25) which state that the fulfilment of the mitzvos while in exile is in order that they not be new when we return to the Eretz Yisrael. Of course, we will understand that once the fulfilment of the taryag mitzvos in Chutz La’aretz is not essential but “provisional”, it could be overridden by other concerns, such as those which led Yaakov to marry two sisters, something which would not have occurred in Eretz Yisrael itself, as the Ramban states.