1

I recently delete all file from current branch, with rm --cached command without delete .git folder. Then staged just one file in current branch. But when I try to push that file to remote repository, there seems other file also partake to transfer. I need to ask two question: 1. Is deleting file from current branch also delete that file from repository? 2. How just to transfer (push) file in current branch, not all file in repo.

enter image description here

Mohammad Fajar
  • 957
  • 1
  • 12
  • 24

1 Answers1

0
  • 1/ Is deleting file from current branch also delete that file from repository?

    No.

  • 2/ How just to transfer (push) file in current branch, not all file in repo.
    you will push all un-pushed commits, not just the last one

You can push only the current branch, with the default push policy "simple".
Your first push should be

git push -u origin yourBranch

But that branch will include all the commits, including your last one (which reference only one file).

If you really want to reset the content of the remote upstream repo, you can have a look at "How to reset a remote GIT repository to remove all commits?".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250