Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans/Git; copy individual files between branches

I'm using Netbeans with Git (hosted on github).

Github uses a special branch in the git repository, "gh-pages", whose content is hosted on their site.

My project generates a stylesheet and demo webpage, which I'm hosting on github to demonstrate the generated stylesheet. In order to do this, I usually just copy the entire "master" branch into "gh-pages" branch and clean-up the "gh-pages" branch afterwards. Needless to say this isn't the most ideal way of working.

I'd like to be able to copy a single file from the "master" branch into the "gh-pages" branch, preferably using just Netbeans' builtin Git support. Is there any way to do this?

like image 201
Martijn Avatar asked Jan 01 '26 05:01

Martijn


1 Answers

not sure about netbeans. But you can simply checkout the file from master when on the other branch with:

git checkout master -- path/to/the/file/you/want/file.txt

Also, you can read out the file with

git show master:path/to/the/file/you/want/file.txt
like image 156
Adam Dymitruk Avatar answered Jan 02 '26 23:01

Adam Dymitruk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!