T
T
Timofey2021-03-03 07:34:03
git
Timofey, 2021-03-03 07:34:03

How to create a new branch and push (send) a file, ignoring the data in the branch from which we start?

How to create a new branch and push changes, ignoring the data in the branch from which we start? You need to add one file, 1 branch - 1 file. .gitignore does not help unfortunately.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timofey, 2021-03-03
@timofeygusevopal

git checkout --orphan=testbranch #create an empty branch
git rm -rf . #remove all current files
git clean -fdx #remove all files in the branch, including ignored and uncommitted ones
git checkout master — test.html #checkout a file from another branch
git commit -am 'initial commit' #commit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question