Git commands
- git init -> To initiate a new git repository.
- git config -> To config the user.name and user.email
- git branch <branch_name> -> To create a new branch
- git checkout <branch/commit> -> To switch to specified commit/branch
- git clone -> To clone a repository form an URL
- git add -> To add file to staging area ( use add . for all)
- git commit -m “message” -> Creates a new commit with message.
- git diff -> Show differences which are not in staging yet
- git status -> List the files to be committed
- git log -> Version history of current branch
- git remote -> used to connect to a remote server
- git push <remote> <branch> -> Used to push to <branch> of <remote>
- git pull -> Fetches and merges change from remote to local
How does Fork works?
- A developer ‘forks’ an ‘official’ server-side repository. This creates their own server-side copy.
- The new server-side copy is cloned to their local system.
- A Git remote path for the ‘official’ repository is added to the local clone.
- A new local feature branch is created.
- The developer makes changes on the new branch.
- New commits are created for the changes.
- The branch gets pushed to the developer’s own server-side copy.
- The developer opens a pull request from the new branch to the ‘official’ repository.
- The pull request gets approved for merge and is merged into the original server-side repository
GIT -> Development
SVN -> Deployment
How to work with MailHog?
After starting the Mailhog, it starts 2 servers basically, one is a client server and the second one is SMTP server, through which the mails would be sent (or will show as sent)
By default the ports would be SMTP : 1025, HTTP : 8025
We can also install mhsendmail and configure it in php.ini like sendmail_path = “/Users/jchristopher/go/bin/mhsendmail”
this would allow testing the mails sent via tha php mail() function as well.
It created a fake SMTP server and instead of sending all the mails, it catches them and shows them under the HTTP panel.
This would help in testing the mails instead of sending them to users
Setting up Local Development Environment & Integrated Development Environment
Installed LocalWP and MailHog in my system.
Installed VScode, and the extensions listed below for now (did not install the wordpress, git and other related extensions as first wanted to try with core PHP)
Tried using them with normal code and saw how they works about warning for the common mistakes and in-efficient development
LocalWP
A tool to help setting up local WordPress sites easily within a few clicks for development
Some important learning aspects from today’s day:
- Did a setup for Linux, vs-code and it’s plugins and tested some plugins and their functionality
- Cleared my Git part which was not clear to me as I did not had much experience with GitHub before, understood the basic logic and reasoning behind Pull requests, branches and other stuff.
- Installed MailHog and got hands on using it by testing some mails via PHPMailer.
- Learned how can also change the sendmail function in php.ini to debug mails sent via php mail() as well
Need to work more on:
- Revising and trying Git more clearly
- Doing more research & reading the documentation about PHPCS
That’s pretty much how my day today went at rtCamp, looking towards more wonderful days.
Regards
–
Aryan Jasala
WordPress Engineer Trainee
