Exhibit 10.12

Execution Version

SECOND AMENDMENT

TO

CREDIT
AGREEMENT

AMONG

REX ENERGY IV, LLC,

as Borrower,

KEYBANK NATIONAL ASSOCIATION,

as Administrative Agent,

and

The Lenders Signatory Hereto

Effective as of July 25, 2007



---

SECOND AMENDMENT TO CREDIT
AGREEMENT

This SECOND AMENDMENT
TO CREDIT AGREEMENT (this Second Amendment) executed effective as of the 25thof July, 2007
(the Second Amendment Effective Date) is among REX ENERGY IV, LLC, a limited liability company formed under the laws of the State of Delaware (the Borrower); and
KEYBANK NATIONAL ASSOCIATION, as administrative agent for the Lenders (in such capacity, together with its successors, the Administrative Agent).

Recitals

A. The Borrower, the
Administrative Agent and the Lenders are parties to that certain Credit Agreement dated as of October 2, 2006, as amended by the First Amendment to Credit Agreement, dated March 30, 2007 (as amended, the Credit
Agreement), pursuant to which the Lenders have made certain credit available to and on behalf of the Borrower.

B. The Borrower
has requested and the Administrative Agent and the Lenders have agreed to amend certain provisions of the Credit Agreement.

C. NOW,
THEREFORE, in consideration of the premises and the mutual covenants herein contained, for good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, the parties hereto agree as follows:

Section 1. Defined Terms. Each capitalized term which is defined in the Credit Agreement, but which is not defined in this Second Amendment,
shall have the meaning ascribed such term in the Credit Agreement. Unless otherwise indicated, all section references in this Second Amendment refer to the Credit Agreement.

Section 2. Amendments to Credit Agreement.

2.1 Amendments to Section 1.02. Section 1.02 is hereby amended by adding or amending and restating the following definitions in their entirety:

Agreement means this Credit Agreement, as amended by the First Amendment to Credit Agreement, dated March 30, 2007 and the Second
Amendment to Credit Agreement, dated July 25, 2007, and as the same may from time to time be amended, modified, supplemented or restated.

Maturity Date means the earlier of (a) the next Business Day following the closing date of the Senior Credit Facility or any similar credit facility or (b) December 31, 2007.

Section 3. Conditions Precedent. The effectiveness of this Second Amendment is subject to the receipt by the Administrative Agent of the
following documents and satisfaction of the other conditions provided in this Section 3, each of which shall be reasonably satisfactory to the Administrative Agent in form and substance:

3.1 Second Amendment. The Administrative Agent shall have received multiple counterparts as requested of this Second Amendment from each Lender.



Page 2



---

3.2 Payment of Outstanding Invoices. Payment by the Borrower to the Administrative Agent of all
fees and other amounts due and payable on or prior to the Second Amendment Effective Date, including, to the extent invoiced, reimbursement or payment of all out-of-pocket expenses required to be reimbursed or paid by the Borrower.

3.3 No Default. No Default or Event of Default shall have occurred and be continuing as of the Second Amendment Effective Date.

Section 4. Representations and Warranties; Etc. The Borrower hereby affirms: (a) that as of the date of execution and delivery of this
Second Amendment, all of the representations and warranties contained in each Loan Document to which the Borrower is a party are true and correct in all material respects as though made on and as of the Second Amendment Effective Date (unless made
as of a specific earlier date, in which case, was true as of such date); and (b) that after giving effect to this Second Amendment and to the transactions contemplated hereby, no Defaults exist under the Loan Documents or will exist under the
Loan Documents.

Section 5. Miscellaneous.

5.1 Confirmation. The provisions of the Credit Agreement (as amended by this Second Amendment) shall remain in full force and effect in accordance with its terms following the effectiveness of this Second
Amendment.

5.2 Ratification and Affirmation of the Borrower. The Borrower hereby expressly (i) acknowledges the terms of this
Second Amendment, (ii) ratifies and affirms its obligations under the Credit Agreement and the other Security Instruments to which it is a party, (iii) acknowledges, renews and extends its continued liability under the Credit Agreement and
the other Security Instruments to which it is a party remains in full force and effect with respect to the Indebtedness as amended hereby.

5.3 RELEASE BY THE BORROWER. THE BORROWER HEREBY ACKNOWLEDGES AND AGREES THAT: (I) IT HAS NO CLAIM OR CAUSE OF ACTION AGAINST THE ADMINISTRATIVE AGENT OR ANY LENDER (OR ANY OF THE DIRECTORS, OFFICERS, EMPLOYEES, AGENTS,
AFFILIATES OR ATTORNEYS OF THE FOREGOING), (II) THE ADMINISTRATIVE AGENT OR ANY LENDER HAS HERETOFORE PROPERLY PERFORMED AND SATISFIED IN A TIMELY MANNER ALL OF ITS OBLIGATIONS TO THE BORROWER AND (III) IT HAS RECEIVED THE ADVICE OF LEGAL COUNSEL
WITH REGARD TO THE RELEASES CONTAINED HEREIN. THE ADMINISTRATIVE AGENT AND THE LENDERS WISH (AND THE BORROWER AGREES) TO ELIMINATE ANY POSSIBILITY THAT ANY PAST CONDITIONS, ACTS, OMISSIONS, EVENTS OR CIRCUMSTANCES WOULD IMPAIR OR OTHERWISE ADVERSELY
AFFECT ANY OF THEIR RIGHTS, INTERESTS, SECURITY AND/OR REMEDIES. FOR AND IN CONSIDERATION OF THE AGREEMENTS CONTAINED IN THIS SECOND AMENDMENT AND OTHER GOOD AND VALUABLE CONSIDERATION, THE BORROWER VOLUNTARILY, KNOWINGLY, INCONDITIONALLY AND
IRREVOCABLY RELEASES, WAIVES AND FOREVER



Page 3



---

DISCHARGES THE ADMINISTRATIVE AGENT OR ANY LENDER, TOGETHER WITH ITS PREDECESSORS, SUCCESSORS, ASSIGNS, SUSIDIARIES, AFFILIATES, AGENTS, EMPLOYEES AND
ATTORNEYS (COLLECTIVELY, THE RELEASED PARTIES), FROM: (X) ANY AND ALL LIABILITIES, OBLIGATIONS, DUTIES, PROMISES OR INDEBTEDNESS OF ANY KIND OF THE BORROWER, WHETHER KNOWN OR UNKNOWN, ANTICIPATED OR UNANTICIPATED, SUSPECTED
OR UNSUSPECTED, FIXED, CONTINGENT, OR CONDITIONAL, AT LAW OR IN EQUITY, ORIGINATING IN WHOLE OR IN PART ON OR BEFORE THE DATE THE SECOND AMENDMENT EFFECTIVE DATE AND (Y) ALL CLAIMS, OFFSETS, CAUSES OF ACTION, SUITS OR DEFENSES OF ANY KIND
WHATSOEVER (IF ANY), WHICH THE BORROWER MIGHT OTHERWISE HAVE AGAINST THE RELEASED PARTIES OR ANY OF THEM, WHETHER KNOWN OR UNKNOWN, ANTICIPATED OR UNANTICIPATED, SUSPECTED OR UNSUSPECTED, FIXED, CONTINGENT, OR CONDITIONAL, AT LAW OR IN EQUITY
ORIGINATING IN WHOLE OR IN PART ON OR BEFORE THE SECOND AMENDMENT EFFECTIVE DATE, IN EITHER CASE (X) OR (Y) IRRESPECTIVE OF WHETHER ANY SUCH CLAIMS ARISE OUT OF CONTRACT, TORT, VIOLATION OF LAW OR REGULATIONS, OR OTHERWISE, OR ARISING FROM
ANY LOANS, INCLUDING, WITHOUT LIMITATION, ANY CONTRACTING FOR, CHARGING, TAKING, RESERVING, COLLECTING OR RECEIVING INTEREST IN EXCESS OF THE HIGHEST LAWFUL RATE APPLICABLE, THE EXERCISE OF ANY RIGHTS AND REMEDIES UNDER THIS SECOND
AMENDMENT, THE CREDIT AGREEMENT OR ANY OF THE OTHER LOAN DOCUMENTS, AND NEGOTIATION FOR AND EXECUTION OF THIS SECOND AMENDMENT, OR ON ACCOUNT OF ANY CONDITION, ACT, OMISSION, EVENT, CONTRACT, LIABILITY , OBLIGATION, INDEBTEDNESS, CLAIM, CAUSE OF
ACTION, DEFENSE, CIRCUMSTANCE OR MATTER OF ANY KIND WHICH EXISTED, AROSE OR OCCURRED AT ANY TIME FROM THE BEGINNING OF THE WORLD TO THE DATE THIS SECOND AMENDMENT BECOMES EFFECTIVE.

5.4 Counterparts. This Second Amendment may be executed by one or more of the parties hereto in any number of separate counterparts, and all of
such counterparts taken together shall be deemed to constitute one and the same instrument.

5.5 No Oral Agreement.
THIS WRITTEN SECOND AMENDMENT, THE CREDIT AGREEMENT AND THE OTHER LOAN
DOCUMENTS EXECUTED IN CONNECTION HEREWITH AND THEREWITH REPRESENT THE FINAL
AGREEMENT BETWEEN THE PARTIES AND MAY NOT BE CONTRADICTED BY EVIDENCE
OF PRIOR, CONTEMPORANEOUS, OR UNWRITTEN ORAL AGREEMENTS OF THE PARTIES. THERE
ARE NO SUBSEQUENT ORAL AGREEMENTS BETWEEN THE PARTIES.

5.6 Governing Law. THIS SECOND AMENDMENT (INCLUDING, BUT
NOT LIMITED TO, THE VALIDITY AND ENFORCEABILITY HEREOF) SHALL BE GOVERNED
BY, AND CONSTRUED IN ACCORDANCE WITH, THE LAWS OF THE STATE OF
TEXAS.



Page 4



---

IN WITNESS WHEREOF, the parties hereto have caused this Second Amendment to be duly executed effective as
of the date first written above.



|          |  |                    |  |                        
|--------- |  | ------------------ |  | -----------------------
|BORROWER: |  | REX ENERGY IV, LLC
|          |  |                   
|          |  | By:                |  | /s/ Benjamin W. Hulburt
|          |  | Name:              |  | Benjamin W. Hulburt    
|          |  | Title:             |  | Chief Executive Officer



Second Amendment

Signature Page - 1



---

|                      |  |                                    |  |               
|--------------------- |  | ---------------------------------- |  | --------------
|ADMINISTRATIVE AGENT: |  | KEYBANK NATIONAL ASSOCIATION,     
|                      |  | as Administrative Agent and Lender
|                      |  |                                   
|                      |  | By:                                |  | /s/ Kevin Hays
|                      |  | Name:                              |  | Kevin Hays    
|                      |  | Title:                             |  | Director      



Second Amendment

Signature Page - 2