I started using vscode, have two branches like main and test,after finishing the work on test branch I switch to main branch and what I want to do is to merge test branch but only to commit&push specific files/directories on main branch.Because I do not need to commit&push all files coming from test branch.Problem is that vscode does not allow me to switch to test branch if I commit&push specific files.So I have to delete the specific files I do not need on main branch and then to commit&push on main branch.I want to commit&push on main branch only successfully tested files coming from test branch.
Before you change to main, you need to run:
git stash push
in vscode - first you access the ... menu at the top of the source control window, then select stash->stash.
According to the docs, this will stash away all remaining changes after the check in on the test branch. Once you stash, you will be allowed to change over to main without vscode or git complaining.
When you switch back to test branch to continue your work, just run
git stash pop
In vscode, its the ... menu in the source control window, then stash->pop latest stash
@hakkican maybe this could help
git checkout branch_name path_file/path_folder
then commit the changes.
or check this link for more explanation https://stackoverflow.com/questions/449541/how-can-i-selectively-merge-or-pick-changes-from-another-branch-in-git