I found this tracing by Dr. Stephen Wellum in his article, Baptism and the Relationships Between the Covenants, very helpful with understanding circumcision. It gives the main purpose of why God gave it and the how it ends in Christ.
  • In the context of the Abrahamic and Mosaic covenants, the primary purpose of circumcision was to mark out a physical seed in preparation for the coming of Messiah. The marking purpose of circumcision may be viewed in two complementary ways.
    • First, circumcision marked out a national entity. With the inauguration of the Abrahamic covenant, God chose one man and his seed to grow into a nation to prepare the way for the coming of Christ…It served as a physical sign to mark out a nation and to distinguish them as his people.
    • Second, circumcision marked out a male line of descent from Abraham to David to Christ. That is why, in a typological way, every Jewish male child, specifi cally those in Judah’s line, was a type of Christ who anticipated the day when the true/unique seed of Abraham would come.
    • (Circumcision also traces out the source of our moral corruption. Adam, as the head of the human race, is held responsible for sin. We were not corrupted through Eve but through Adam, and circumcision reminds us of this as well as the need for a radical spiritual surgery—hence it speaks of the need for a “circumcision of the heart.”)
  • But under the Mosaic covenant, there was also another purpose of circumcision which begins to point to spiritual and typological realities.
    • In this regard, physical circumcision pointed to the need of a spiritually circumcised heart which would result in a wholehearted devotion to the Lord (Deut 30:6; cp. Jer 4:4). Indeed, the new covenant promise in Jer 31:33 of the “law written on their hearts” combined with Ezek 36:25–27 pointed forward to the day when the entire covenant community would be circumcised in heart.
    • This emphasis picks up the teaching of the prophets that physical circumcisiononly availed the one who had been spiritually circumcised (see Rom 2:25–29). In this sense, circumcision serves as a type that finds its fulfillment and replacement in regeneration.
  • Now, in Christ, and the creation of the “new man” (Eph 2:11–22), the law-covenant has been fulfilled and the God-given divisions tied to that law-covenant have been removed so much so that Paul can proclaim, “Neither circumcision nor uncircumcisionmeans anything; what counts is a new creation” (Gal 6:15).
    • In this new era, a new covenantal sign, baptism, has been established to testify of the gospel and to identify one as having become the spiritual seed of Abraham, through faith in Messiah Jesus.
    • But unlike circumcision, baptism is not a sign of physical descent, nor is it a sign that anticipates gospel realities. Rather it is a sign that signifies a believer’s union with Christ and all the benefi ts that are entailed by that union.

~Stephen Wellum,  Baptism and the Relationships Between the Covenants, 163-165