<?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>1040 - 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>D2013Q2YTD</ContextID><EntitySchema>http://www.sec.gov/CIK</EntitySchema><EntityValue>0001048620</EntityValue><PeriodDisplayName /><PeriodType>duration</PeriodType><PeriodStartDate>2012-12-26T00:00:00</PeriodStartDate><PeriodEndDate>2013-07-02T00: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="Jul. 02, 2013" /></Labels></Column></Columns><Rows><Row FlagID="0"><Id>1</Id><IsAbstractGroupTitle>true</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><Level>1</Level><ElementName>us-gaap_CommitmentsAndContingenciesDisclosureAbstract</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><FootnoteIndexer /><Cells><Cell FlagID="0" ContextID="" UnitID=""><Id>1</Id><IsNumeric>false</IsNumeric><IsRatio>false</IsRatio><DisplayZeroAsNone>false</DisplayZeroAsNone><NumericAmount>0</NumericAmount><RoundedNumericAmount>0</RoundedNumericAmount><NonNumbericText /><FootnoteIndexer /><CurrencyCode /><CurrencySymbol /><IsIndependantCurrency>false</IsIndependantCurrency><ShowCurrencySymbol>false</ShowCurrencySymbol><DisplayDateInUSFormat>false</DisplayDateInUSFormat></Cell></Cells><ElementDataType>xbrli:stringItemType</ElementDataType><SimpleDataType>string</SimpleDataType><IsTotalLabel>false</IsTotalLabel><UnitID>0</UnitID><Label>Commitments and contingencies</Label></Row><Row FlagID="0"><Id>2</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><Level>2</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="D2013Q2YTD" UnitID=""><Id>1</Id><IsNumeric>false</IsNumeric><IsRatio>false</IsRatio><DisplayZeroAsNone>false</DisplayZeroAsNone><NumericAmount>0</NumericAmount><RoundedNumericAmount>0</RoundedNumericAmount><NonNumbericText>&lt;div style="font-size:10.0pt;font-family:Times New Roman;"&gt;
&lt;p style="MARGIN: 0in 0in 0pt;"&gt;&lt;b&gt;&lt;font style="FONT-FAMILY: Times New Roman; FONT-SIZE: 10pt; FONT-WEIGHT: bold;" size="2"&gt;4.&lt;/font&gt;&lt;/b&gt;&lt;b&gt;&lt;font style="FONT-SIZE: 3pt; FONT-WEIGHT: bold;" size="1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/font&gt;&lt;/b&gt; &lt;b&gt;&lt;font style="FONT-SIZE: 10pt; FONT-WEIGHT: bold;" size="2"&gt;Commitments and contingencies&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt;"&gt;&amp;#160;&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt;"&gt;&lt;font style="FONT-FAMILY: Times New Roman; FONT-SIZE: 10pt;" size="2"&gt;Leases&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt;"&gt;&amp;#160;&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt 0.25in;"&gt;&lt;font style="FONT-FAMILY: Times New Roman; FONT-SIZE: 10pt;" size="2"&gt;In October&amp;#160;2012, the Company entered into a 10-year lease agreement for a site in Lyndhurst, Ohio where it plans to construct a Granite City restaurant.&amp;#160; Per the terms of the lease, the landlord will pay the Company a tenant improvement allowance of approximately $1.2 million.&amp;#160; The lease, which may be extended at the Company&amp;#8217;s option for up to two additional five-year periods, calls for annual base rent starting at $456,850.&amp;#160; The Company anticipates opening this restaurant in the fall of 2013.&amp;#160; Under the terms of the lease, the Company may be required to pay additional contingent rent based upon restaurant sales.&lt;/font&gt;&lt;/p&gt;
&lt;p style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.25in;"&gt;&amp;#160;&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt 0.25in;"&gt;&lt;font style="FONT-FAMILY: Times New Roman; FONT-SIZE: 10pt;" size="2"&gt;In May&amp;#160;2013, the Company entered into an agreement to purchase approximately 2.5 acres of land in Louisville, Kentucky for $1.8 million, where it plans to construct a Granite City restaurant.&amp;#160; Additionally, the Company entered into a purchase and sale agreement with Store Capital Acquisitions, LLC (&amp;#8220;Store Capital&amp;#8221;) regarding this restaurant.&amp;#160; Pursuant to the agreement, Store Capital will purchase the property and improvements for the lesser of $4.5 million or the actual costs the Company incurs for the property and construction of the restaurant thereon.&amp;#160; Upon the closing of the sale, the Company will enter into an agreement with Store Capital whereby the Company will lease the restaurant from Store Capital for an initial term of 15 years at an annual rental rate equal to the purchase price multiplied by a capitalization rate equal to 8.75%.&amp;#160; Such agreement will include options for additional terms and provisions for rental adjustments.&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt 0.25in;"&gt;&amp;#160;&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt 0.25in;"&gt;&lt;font style="FONT-FAMILY: Times New Roman; FONT-SIZE: 10pt;" size="2"&gt;In July&amp;#160;2013, the Company entered into a 15-year lease agreement for a site in Northville, Michigan where it plans to construct a Granite City restaurant.&amp;#160; Per the terms of the lease, the landlord will pay the Company a tenant improvement allowance of approximately $1.0 million.&amp;#160; The lease, which may be extended at the Company&amp;#8217;s option for up to two additional five-year periods, calls for annual base rent starting at $417,480.&amp;#160; Under the terms of the lease, the Company may be required to pay additional contingent rent based upon restaurant sales.&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 0pt;"&gt;&amp;#160;&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 FASB Interpretation (FIN)

 -Number 14

 -Paragraph 3

 -LegacyDoc This reference is SUPERSEDED by the Accounting Standards Codification effective for interim and annual periods ending after September 15, 2009.  This reference is included to help users transition from the previous accounting hierarchy and will be removed from future versions of this taxonomy.



Reference 2: 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 3: 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 4: 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 5: 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=6952336&amp;loc=d3e14435-108349



Reference 6: 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



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

 -Publisher FASB

 -Name Statement of Financial Accounting Standard (FAS)

 -Number 5

 -Paragraph 9, 10, 11, 12

 -LegacyDoc This reference is SUPERSEDED by the Accounting Standards Codification effective for interim and annual periods ending after September 15, 2009.  This reference is included to help users transition from the previous accounting hierarchy and will be removed from future versions of this taxonomy.



</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.gcfb.net/role/DisclosureCommitmentsAndContingencies</RoleURI><NumberOfCols>1</NumberOfCols><NumberOfRows>2</NumberOfRows></InstanceReport>
