Over the past several months, I’ve had to learn a new skill – a technical skill which I had no clue about and it’s related to software development. I decided to write some of the commands and stats I”ve learnt and may potentially forget. So here we go, let me share with you some of the tools I’ve used and the commands I’ve learnt:

Bitbucket

Our software development agency uses Bitbucket and I just fell into learning this. It’s an Atlassian product and there is a Free tier for Small teams. You basically store all your code on Bitbucket and it allows you to track and manage code. Updating code is so much easier when using GIT. In my situation, our development agency makes changes to the code and pushes the changes to a repository (Bitbucket) and then on our systems, whether it’s our development or production server we pull down the changes.

Here’s what I had to do to install the GIT software on our Virtual Private Server.

Install GIT

You need to install the GIT software:

sudo yum install git

Setup GIT

Use these commands and replace them with your username and email address

git config –global user.name “xx”
git config –global user.email “xx@email.com”

git init

Add ssh keys to Bitbucket

To be able to push and pull from Bitbucket, you need to setup the ssh keys. Set this up on the VPS and then Bitbucket

Generate the key using SSH on the VPS

ssh-keygen

take all default

ls ~/.ssh

vi ~/.ssh/id_rsa.pub

Then in Bitbucket click on your Personal profile and then Bitbucket settings:

LEARNING ABOUT GIT REPOSITORY personal account settings

Bitbucket Settings

Click on SSH keys

Bitbucket Settings SSH Key

Click on Add Keys that was previously generated from the VPS

Bitbucket Settings SSH keys Add Key Details

Add changed files to the repository

Issue the command

git add –all

If you just want to add several files check first of all the files that have changed by using

git status 

Commit

If you want to add your list of file changes to the repository then you need to commit and add a name

git commit -m “Initial Commit”

git remote add origin git@bitbucket.org:[project name]

git push -u origin master

Delete files

If you need to delete files from the repository use these commands:

git rm -r —cached .

git add .

git commit -m “.gitignore after clearing cache”

git push -u origin master

Git Pull from repository

If you need to download the latest changes from the repository then use

git remote add origin git@bitbucket.org:[project name]

git pull origin master

Now if the developer set up a new branch, then use the correct name.

There are other tools like GitHub but I personally haven’t used it yet.

There’s probably more to learn and will update this post as I go.

Other Useful Commands

git restore [filename] – to stash and restore a modified file

git config –list – this shows the global config list

git remote -v – shows the remote repository

git remove rm origin – removes the git origin

git checkout – changed the head to a particular commit

git checkout . –  to checkout all the modified files

git reset –hard xxxx (commit ID) –  to rollback to a previous commit

git reset –hard origin/master – force to pull the latest commit

git log – to check the log

git clean -d -f – to remove files on local machine before merging

git config –global –edit – to change the global configuration such as name and email address

git commit –amend –reset-author – to reset the author details before pushing commit to git

git checkout (branch name) -to switch to another branch

git push origin (branch name) – to push to branch

git rm -r –cached [folder] – to remove a folder from local machine e.g. vendor/ in laravel

If you’re using laravel as your framework, then you can use the below commands to update your database changes:

php artisan migrate
php artisan migrate:status

Subscribe to my newsletter where I will share my journey in affiliate marketing, business, technology, fitness and life in general. Hopefully, this motivates you to also change your journey in life.

This field is required.

Subscribe to my newsletter where I will share my journey in affiliate marketing, business, technology, fitness and life in general. Hopefully, this motivates you to also change your journey in life.

This field is required.

If this article helped you in any way and you want to show your appreciation, I am more than happy to receive donations through PayPal. This will help me maintain and improve this website so I can help more people out there. Thank you for your help.

HELP OTHERS AND SHARE THIS ARTICLE


2Shares

LEAVE A COMMENT