delete a file on my local branch using git

I have some changes in some of my files which were already there. Then I have added a new file in it using

git add newfilename

I didn’t commited yet, Now I want to delete this new file. I can’t do the reset as it will reset all other file changes also which I don;t want.

  • Git branch experiment
  • Is checking out remote branches in git safe now?
  • How to move bugfixes across branches in DVCS?
  • git checkout '…' always results in error: pathspec '…' did not match any file(s) known to git
  • Combining history of merged branches in GIT?
  • git: Find the oldest commit of `mine` which does not exist in `theirs`
  • I tried git checkout newfilename and usual guesses delete and rm also but not helping.

  • Jenkins job for multilevel maven project
  • Pushing Git Repo to Remote Server
  • Modifying Git Diff files
  • Is using a central repository going against GIT's purpose?
  • Rename merged branch name in bitbucket
  • transmit vs macfusion (osx), a remote drive using Git
  • 3 Solutions collect form web for “delete a file on my local branch using git”

    git reset newfilename will remove it from the index and then you can delete it as usual.

    Try a

    git rm --cached newfilename

    To at least remove it from the index.

    Just you can remove a file from your branch by using this command:

    $git rm file_name

    Git Baby is a git and github fan, let's start git clone.