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.

  • Changing branches in git results in changed files
  • `git branch --list` returns files?
  • git — locking master branch for some users?
  • Creating aliases for Git branch names
  • When to delete Version Control branches?
  • how to create git branch in remote repository without checking out using jgit
  • I tried git checkout newfilename and usual guesses delete and rm also but not helping.

  • In Jenkins, what does the “Publish to Subversion repository” in Add post-build action dropdown do?
  • Git branch switching does not change code folder files
  • managing git and svn at the same time?
  • git bash: git@server: command not found
  • git ignore vendor directory in Zend Framework 2
  • Branching from a Tag
  • 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.