I found that adding “-i” to the commit command fixes this problem for me. The -i basically tells it to stage additional files before committing. That is:
git commit -i myfile.php
Related Posts:
- How to resolve merge conflicts in a Git repository
- Resolve Git merge conflicts in favor of their changes during a pull
- What is the best (and safest) way to merge a Git branch into master?
- Undo a Git merge that hasn’t been pushed yet
- Git merge hotfix branch into feature branch
- Abort a Git Merge
- How can I merge multiple commits onto another branch as a single squashed commit?
- How can I merge multiple commits onto another branch as a single squashed commit?
- How to revert multiple git commits?
- The following untracked working tree files would be overwritten by merge, but I don’t care
- How to revert multiple git commits?
- The following untracked working tree files would be overwritten by merge, but I don’t care
- Is there a “theirs” version of “git merge -s ours”?
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- The following untracked working tree files would be overwritten by merge, but I don’t care
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- git – Your branch is ahead of ‘origin/master’ by 1 commit
- Is there a “theirs” version of “git merge -s ours”?
- Updates were rejected because the remote contains work that you do not have locally
- Is it possible to pull just one file in Git?
- How to resolve git status “Unmerged paths:”?
- How to keep a branch synchronized/updated with master?
- Found a swap file by the name
- Is there a git-merge –dry-run option?
- Git pull – Please move or remove them before you can merge
- How can I push a specific commit to a remote, and not previous commits?
- How do I check out a remote Git branch?
- How to use Git Revert
- How do I properly force a Git push?
- How to remove local (untracked) files from the current Git working tree
- How to modify existing, unpushed commit messages?
- Git pushing to remote branch
- How to revert a merge commit that’s already pushed to remote branch?
- GitHub Error Message – Permission denied (publickey)
- Git : fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists
- How do I push a new local branch to a remote Git repository and track it too?
- How do you push a tag to a remote repository using Git?
- Remove files from Git commit
- Gitignore not working
- How to solve SSL certificate: self signed certificate when cloning repo from github?
- How do I resolve git saying “Commit your changes or stash them before you can merge”?
- How do I rename both a Git local and remote branch name?
- How to cherry-pick multiple commits
- Undo git pull, how to bring repos to old state
- Another git process seems to be running in this repository
- rejected master -> master (non-fast-forward)
- merge one local branch into another local branch
- Move the most recent commit(s) to a new branch with Git
- What does “Git push non-fast-forward updates were rejected” mean?
- How do I diff the same file between two different commits on the same branch?
- You have not concluded your merge (MERGE_HEAD exists)
- How to get the current branch name in Git?
- Meaning of the GitHub message: push declined due to email privacy restrictions
- Is there a command to undo git init?
- How to undo ‘git reset’?
- Download a single folder or directory from a GitHub repo
- fatal: Not a valid object name: ‘master’
- Git and nasty “error: cannot lock existing info/refs fatal”
- Is there a “git touch” so I can push the same file with a new timestamp?
- Branch from a previous commit using Git
- How do I delete a local repository in git?
- Throw away local commits in Git
- Hard reset of a single file
- Not a valid object name: ‘master’
- git add remote branch
- How do I copy a version of a single file from one Git branch to another?
- Undo a git stash
- Undo git stash pop that results in merge conflict
- Git: cannot checkout branch – error: pathspec ‘…’ did not match any file(s) known to git
- Set up git to pull and push all branches
- Unity Collaborate vs GitHub
- What is the difference between pull and clone in git?
- How do I clone a single branch in Git?
- how to reset develop branch to master
- “fatal: HttpRequestException encountered.” Error with GitHub/Bitbucket Repositories due to dropping TLS-1.0 support
- SourceTree keeps asking for Github password
- How to change the license for a project at Github?
- Git add all files modified, deleted, and untracked?
- How to switch back to ‘master’ with git?
- fatal: could not read Username for ‘https://github.com’: No such file or directory
- Github Authentication Failed – … GitHub does not provide shell access
- How do I pull files from remote without overwriting local files?
- TortoiseGit-git did not exit cleanly (exit code 1)
- How to `git pull` while ignoring local changes?
- Your repository has no remotes configured to push to
- Uninitialize git repository
- Specify an SSH key for git push for a given domain
- How do I “un-revert” a reverted Git commit?
- git push not send changes to remote git repository
- How to merge a specific commit in Git
- How do I clone a subdirectory only of a Git repository?
- What is the .git folder?
- How to use Git and Dropbox together?
- Git: Where exactly is the “working directory”?
- What exactly does the “u” do? “git push -u origin master” vs “git push origin master”
- Collaboratively develop a WordPress site
- Add latest commit info on login footer using login_footer hook
- WordPress Core files not being ignored by Git
- Display GitLab repositories of the logged in user on a page
- Full site editor, hard-coded IDs in query blocks, and staging/dev servers