You have to define the working dir as well. Confusing I know but it’s a flexibility thing.
git --git-dir=/mycode/.git --work-tree=/mycode status
You can read a little more here
More Related Contents:
- Can “git pull” automatically stash and pop pending changes?
- Merge, update, and pull Git branches without using checkouts
- How to compare a local Git branch with its remote branch
- Change first commit of project with Git? [duplicate]
- What’s the equivalent of Subversion’s “use-commit-times” for Git?
- Checking out old files WITH original create/modified timestamps
- Warning: push.default is unset; its implicit value is changing in Git 2.0
- What exactly does the “u” do? “git push -u origin master” vs “git push origin master”
- configure Git to accept a particular self-signed server certificate for a particular https remote
- How do you make Git ignore files without using .gitignore?
- How to migrate GIT repository from one server to a new one
- What is the `git restore` command and what is the difference between `git restore` and `git reset`?
- Git pull after forced update
- Where to store my Git personal access token?
- How do I merge a sub directory in Git?
- Is there any git hook for pull?
- Git diff with line numbers (Git log with line numbers)
- Use git “log” from another folder
- How to split a git repository while preserving subdirectories?
- Is it possible to pull from one repo and push to other one?
- Which are the plumbing and porcelain commands?
- Git On Custom SSH Port
- github: No supported authentication methods available
- How do I add files and folders into GitHub repos?
- Git: add vs push vs commit
- Push and pull my conda environment using git
- Git Clone – Repository not found
- Why has git-filter-branch not rewritten tags?
- git – remote add origin vs remote set-url origin
- git clone with HTTPS or SSH remote?