when I delete files from one branch it deletes from all branches. what can I do?
The easiest way to delete a file in your Git repository is to execute the “git rm” command and to specify the file to be deleted. Note that by using the “git rm” command, the file will also be deleted from the filesystem.
The git rm command can be used to remove individual files or a collection of files. The primary function of git rm is to remove tracked files from the Git index. Additionally, git rm can be used to remove files from both the staging index and the working directory.
when deleting a file with git and persisting that project state (git commit
) it will only be deleted in that commit and its children (speaking: in that branch). when merging that branch into another branch it might well be possible, that the file is going to be deleted (unless changed in the other branch).
when deleting a file, not committing it and then switching branches, git will apply your current set of changes to the other branch, in your case deleting the file there too. committing the delete should avoid the issue you are seeing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With