code: def git_in_tmpdir(tmpdir):
      """Return a function that will execute git instruction in the desired directory"""
  
      def git(*args):
          out = system("git", *args, cwd=str(tmpdir))
          print(out)
          return out
  
      git("init", "--initial-branch", "main")
      git("status")
      git("config", "user.name", "jupytext-test-cli")
      git("config", "user.email", "jupytext@tests.com")
  
      return git
  
file_path: jupytext/tests/external/pre_commit/test_pre_commit_scripts.py
imports: import os
  import stat
  import unittest.mock
  import pytest
  from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook
  from jupytext import read, write
  from jupytext.cli import jupytext, system
  from jupytext.compare import compare_cells, compare_notebooks
label_desc: Use image node_id 1 for calling a global function with example usage: git_in_tmpdir(tmpdir) and returns: git, out