<?xml version="1.0" encoding="us-ascii"?><InstanceReport xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Version>2.4.0.8</Version><ReportLongName>128 - Disclosure - Commitments and contingencies</ReportLongName><DisplayLabelColumn>true</DisplayLabelColumn><ShowElementNames>false</ShowElementNames><RoundingOption /><HasEmbeddedReports>false</HasEmbeddedReports><Columns><Column FlagID="0"><Id>1</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><CurrencyCode /><FootnoteIndexer /><hasSegments>false</hasSegments><hasScenarios>false</hasScenarios><MCU><KeyName /><CurrencySymbol /><contextRef><ContextID>eol_PE11654---1310-Q0007_STD_181_20130630_0</ContextID><EntitySchema>http://www.sec.gov/CIK</EntitySchema><EntityValue>0001024732</EntityValue><PeriodDisplayName /><PeriodType>duration</PeriodType><PeriodStartDate>2013-01-01T00:00:00</PeriodStartDate><PeriodEndDate>2013-06-30T00:00:00</PeriodEndDate><Segments /><Scenarios /></contextRef><UPS /><CurrencyCode /><OriginalCurrencyCode /></MCU><CurrencySymbol /><Labels><Label Key="CalendarSupplement" Id="0" Label="6 Months Ended" /><Label Key="Calendar" Id="1" Label="Jun. 30, 2013" /></Labels></Column></Columns><Rows><Row FlagID="0"><Id>1</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><Level>4</Level><ElementName>us-gaap_CommitmentsAndContingenciesDisclosureTextBlock</ElementName><ElementPrefix>us-gaap_</ElementPrefix><IsBaseElement>true</IsBaseElement><BalanceType>na</BalanceType><PeriodType>duration</PeriodType><IsReportTitle>false</IsReportTitle><IsSegmentTitle>false</IsSegmentTitle><IsCalendarTitle>false</IsCalendarTitle><IsEquityPrevioslyReportedAsRow>false</IsEquityPrevioslyReportedAsRow><IsEquityAdjustmentRow>false</IsEquityAdjustmentRow><IsBeginningBalance>false</IsBeginningBalance><IsEndingBalance>false</IsEndingBalance><IsReverseSign>false</IsReverseSign><PreferredLabelRole>terseLabel</PreferredLabelRole><FootnoteIndexer /><Cells><Cell FlagID="0" ContextID="eol_PE11654---1310-Q0007_STD_181_20130630_0" UnitID=""><Id>1</Id><IsNumeric>false</IsNumeric><IsRatio>false</IsRatio><DisplayZeroAsNone>false</DisplayZeroAsNone><NumericAmount>0</NumericAmount><RoundedNumericAmount>0</RoundedNumericAmount><NonNumbericText>&lt;div&gt;
&lt;table style="BORDER-COLLAPSE:COLLAPSE" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;
&lt;tr&gt;
&lt;td width="4%" valign="top" align="left"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;&lt;b&gt;20.&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td align="left" valign="top"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;&lt;b&gt;Commitments and
contingencies&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p style="margin-top:6px;margin-bottom:0px"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;&lt;i&gt;Capital
commitments&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:6px;margin-bottom:0px; text-indent:4%"&gt;
&lt;font style="font-family:Times New Roman" size="2"&gt;As of
June&amp;#xA0;30, 2013, the Company has open purchase orders totaling
$49.4 million towards construction of new facilities and purchase
of property and equipment.&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:18px;margin-bottom:0px"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;&lt;i&gt;Bank
guarantees&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:6px;margin-bottom:0px; text-indent:4%"&gt;
&lt;font style="font-family:Times New Roman" size="2"&gt;As of
June&amp;#xA0;30, 2013, guarantees and letters of credit provided by
banks on behalf of the Company&amp;#x2019;s subsidiaries, to customs
authorities and vendors for capital procurements amounted to $2.4
million. These guarantees and letters of credit have a remaining
term of approximately one to five years.&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:18px;margin-bottom:0px"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;&lt;i&gt;Other
commitments&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:6px;margin-bottom:0px; text-indent:4%"&gt;
&lt;font style="font-family:Times New Roman" size="2"&gt;The
Company&amp;#x2019;s business process delivery centers in India are 100%
Export Oriented units or Software Technology Parks
(&amp;#x201C;STP&amp;#x201D;) and SEZs under the STP and SEZ guidelines
issued by the Government of India. These units are exempted from
customs, central excise duties, and levies on imported and
indigenous capital goods, stores, and spares. The Company has
executed legal undertakings to pay custom duties, central excise
duties, levies, and liquidated damages payable, if any, in respect
of imported and indigenous capital goods, stores, and spares
consumed duty free, in the event that certain terms and conditions
are not fulfilled.&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:12px;margin-bottom:0px; text-indent:4%"&gt;
&lt;font style="font-family:Times New Roman" size="2"&gt;The Company has
entered into a service agreement with a customer that provides such
customer the option, exercisable at any time by providing 60
days&amp;#x2019; notice to the Company to acquire an equity stake of up
to 7.00% of the Company&amp;#x2019;s outstanding voting shares at fair
market value. The fair market value is the volume weighted average
trading price of the Company&amp;#x2019;s shares on the NASDAQ Market
for five consecutive trading days immediately before the date on
which the customer delivers its notice under the option. The option
does not restrict the customer in any way from buying the
Company&amp;#x2019;s shares in the open market. The service agreement
also requires the Company to register the shares upon exercise of
the option by the customer and there are no events or circumstances
that would require the Company to transfer consideration under the
agreement.&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:18px;margin-bottom:0px"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;&lt;i&gt;Contingencies&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:6px;margin-bottom:0px"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;&lt;i&gt;Income
Taxes&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:6px;margin-bottom:0px; text-indent:4%"&gt;
&lt;font style="font-family:Times New Roman" size="2"&gt;As of
June&amp;#xA0;30, 2013, the Company had tax demands amounting to $54.2
million from the Income Tax Authorities (&amp;#x2018;IT
Authorities&amp;#x2019;) in India. The demands were raised mainly on
account of disallowance of certain tax holiday benefits and
transfer pricing adjustments. . Although, the Company has paid an
amount of $18.5 million in relation to these demands, which are
pending at various levels of appeals, management considers these
disallowances and transfer pricing adjustments as not tenable
against the Company, and therefore no provision for tax
contingencies has been established related to unpaid
amounts.&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:12px;margin-bottom:0px; text-indent:4%"&gt;
&lt;font style="font-family:Times New Roman" size="2"&gt;During the three
months ended June&amp;#xA0;30, 2013, the Company received Orders from
the Bombay High Court, wherein most of the grounds of appeal raised
by the IT Authorities were not admitted. In view of these High
Court Orders, there is a substantial reduction in the tax demands
as of June&amp;#xA0;30, 2013.&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:18px;margin-bottom:0px"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;&lt;i&gt;Litigation&lt;/i&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="margin-top:6px;margin-bottom:0px"&gt;&lt;font style="font-family:Times New Roman" size="2"&gt;The Company is involved in
lawsuits, claims, investigations, and proceedings that arise in the
ordinary course of business. The Company has been named as a
defendant, in a law suit, &lt;i&gt;Ashish Kumar Jain, Individually and On
Behalf of All Others Similarly Situated v. iGATE Corporation and
Phaneesh Murthy,&lt;/i&gt; which is filed in the United States District
Court for the Northern District of California alleging, among other
things, that the defendants deceived shareholders by failing to
disclose information concerning the relationship between our former
Chief Executive Officer, Phaneesh Murthy and an employee of the
Company.&lt;/font&gt;&lt;/p&gt;
&lt;p style="font-size:1px;margin-top:24px;margin-bottom:0px"&gt;
&amp;#xA0;&lt;/p&gt;
&lt;p style="margin-top:0px;margin-bottom:0px; text-indent:4%"&gt;
&lt;font style="font-family:Times New Roman" size="2"&gt;The Company
expects to prevail in this litigation. Furthermore, management
believes that the likelihood of a material loss with respect to any
of these matters is remote.&lt;/font&gt;&lt;/p&gt;
&lt;/div&gt;</NonNumbericText><FootnoteIndexer /><CurrencyCode /><CurrencySymbol /><IsIndependantCurrency>false</IsIndependantCurrency><ShowCurrencySymbol>false</ShowCurrencySymbol><DisplayDateInUSFormat>false</DisplayDateInUSFormat></Cell></Cells><ElementDataType>nonnum:textBlockItemType</ElementDataType><SimpleDataType>na</SimpleDataType><ElementDefenition>The entire disclosure for commitments and contingencies.</ElementDefenition><ElementReferences>Reference 1: http://www.xbrl.org/2003/role/presentationRef

 -Publisher FASB

 -Name Accounting Standards Codification

 -Topic 210

 -SubTopic 10

 -Section S99

 -Paragraph 1

 -Subparagraph (SX 210.5-02.25)

 -URI http://asc.fasb.org/extlink&amp;oid=6877327&amp;loc=d3e13212-122682



Reference 2: http://www.xbrl.org/2003/role/presentationRef

 -Publisher FASB

 -Name Accounting Standards Codification

 -Topic 825

 -SubTopic 20

 -Section 50

 -Paragraph 1

 -URI http://asc.fasb.org/extlink&amp;oid=6449706&amp;loc=d3e16207-108621



Reference 3: http://www.xbrl.org/2003/role/presentationRef

 -Publisher FASB

 -Name Accounting Standards Codification

 -Topic 460

 -SubTopic 10

 -Section 50

 -Paragraph 8

 -URI http://asc.fasb.org/extlink&amp;oid=6398077&amp;loc=d3e12565-110249



Reference 4: http://www.xbrl.org/2003/role/presentationRef

 -Publisher FASB

 -Name Accounting Standards Codification

 -Topic 450

 -SubTopic 20

 -Section 50

 -Paragraph 4

 -URI http://asc.fasb.org/extlink&amp;oid=25496072&amp;loc=d3e14435-108349



Reference 5: http://www.xbrl.org/2003/role/presentationRef

 -Publisher FASB

 -Name Accounting Standards Codification

 -Topic 440

 -SubTopic 10

 -Section 50

 -Paragraph 2

 -URI http://asc.fasb.org/extlink&amp;oid=6394976&amp;loc=d3e25287-109308



</ElementReferences><IsTotalLabel>false</IsTotalLabel><UnitID>0</UnitID><Label>Commitments and contingencies</Label></Row></Rows><Footnotes /><IsEquityReport>false</IsEquityReport><ReportName>Commitments and contingencies</ReportName><MonetaryRoundingLevel>UnKnown</MonetaryRoundingLevel><SharesRoundingLevel>UnKnown</SharesRoundingLevel><PerShareRoundingLevel>UnKnown</PerShareRoundingLevel><ExchangeRateRoundingLevel>UnKnown</ExchangeRateRoundingLevel><HasCustomUnits>true</HasCustomUnits><IsEmbedReport>false</IsEmbedReport><IsMultiCurrency>false</IsMultiCurrency><ReportType>Sheet</ReportType><RoleURI>http://www.igate.com/taxonomy/role/NotesToFinancialStatementsCommitmentsAndContingenciesDisclosureTextBlock</RoleURI><NumberOfCols>1</NumberOfCols><NumberOfRows>1</NumberOfRows></InstanceReport>
