Restore default branch from tag while preserving history
2023-04-06
Fore self reference: To restore default branch from a tag while preserving history, do: $ git checkout tags/v1.2.3 -b v1.2.3 $ git diff main > /tmp/diff.patch $ git checkout main $ cat /tmp/diff.patch | git apply $ git commit -am "Rolled back to v1.2.3" $ git push origin main
1 minute
How I setup git for my WordPress installation in BlueHost
2016-02-24
I’m not sure if this is the “proper” way to do it. Well, it sort of works for me at the moment so I thought I’ll share it here. I did use FTP at first (using FileZilla) but I didnt really like the workflow. Host: BlueHost shared account Client: Windows 10 Prerequisites SSH/Shell Access should be enabled. I enabled this from my cPanel -> SSH/Shell Access menu. Server/Host side SSH to BlueHost host. By default, my website was installed inside ~/public_html folder. I created a new folder named ~/www-checkout. This will be my new “live” website. I copied everything from ~/public_html to ~/www-checkout. $ cp -rv ~/public_html/ ~/www-checkout/ I renamed my ~/public_html to ~/public_html_original. Just for backup. $ mv ~/public_html ~/public_html_original Then I created a symbolic link named ~/public_html that points to ~/www-checkout. $ ln -s ~/www-checkout ~/public_html Then I created my main git repository folder named ~/www.git. $ mkdir www.git $ cd www.git $ git --bare init Then I added a post-receive script inside hooks folder that will do a checkout to ~/www-checkout every time the repository is updated. $ cd hooks $ touch post-receive $ chmod 755 post-receive Contents of post-receive (edited using vim) #!/bin/sh GIT_WORK_TREE=~/www-checkout git checkout -f Then I created a new “work” folder named ~/www-work for my initial commit, cloned the still empty git repository, then copied the contents of ~/www-checkout. $ cd && mkdir www-work $ cd www-work $ git clone ~/www.git Before the commit, I deleted the files that I thought should not be included in the source. wp-content/plugins wp-content/upgrade wp-content/uploads (Optional) Edit source files. Commit source files. $ git add --all $ git commit -a -m "Initial commit." $ git push -u origin master Thats it. Now to the client side.
Bluehost · Git · Tech · Wordpress
2 minutes