Skip to main content

Github Tutorial

  • GitHub brings together the world's largest community of developers to discover, share, and build better software.
  • Delivered through software as a service(SAAS) business model
  • 2008 by linus (Owner: Microsoft) 

#Create New Repository in Github

  1. New Repository
  2. Add Repository Name and description
  3. Public / Private, initialize this repo with Read Me
  4. Create repository

create a new repository on the command line

echo "#test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/sinuna/test.gitgit push -u origin master

…or push an existing repository from the command line

git remote add origin https://github.com/sinuna/firstRepository.gitgit push -u origin master

…or import code from another repository

You can initialize this repository with code from a Subversion, Mercurial, or TFS project.

Initialize Repo

$ git init

Clone Repo

$ git clone https://github.com/<username>/test.git 

 Repositories (remotes) whose branches you track
$ git remote -v

Push files in Github

git clone https://github.com/sinuna/test.git
git add .
git commit -am file_name or folder_name
git push origin master

Delete

$ git rm -r file_name

Branching

$ git switch -c <new-branch-name>

$ git branch
  develop
  feature_x
  master

$ git switch master
$ git switch develop
$ git switch feature_x
$ git config --global alias.sw 'switch'
$ git sw master

git log(shows previous commit)

Check status

$ git status

Merging

Nonetheless, here's how you merge-in changes from origin's feature_x branch:

$ git fetch origin
$ git merge origin/feature_x

Pulling

Pulling is just doing a fetch followed by a merge.
$ git pull origin/feature_x

Deleting Branches

Delete a local branch:
Use the -D option flag to force it.


$ git branch -d <local_branch>



   branch.     List, create, or delete branches
   checkout   Switch branches or restore working tree files
   commit     Record changes to the repository
   merge      Join two or more development histories together
   pull       Fetch from and integrate with another repository or a local branch
   push       Update remote refs along with associated objects

Git: working with branches
1. Git branch (show all the branches including orgin)
2. Git branch develop (creating new branch "develop")
3. git checkout develop (go to "develop" branch)
4. Git status (showing the any commit changes)
5. git commit -am "adding something new"
6. git log (you can see no. of commit you have made)
7. git checkout master
8. git checkout develop
8. git checkout -b feature/newFeature (new way of creating branch) (this will be going to reference of the develop branch and create a new branch based on the develop branch)





GIT: Merging and Workflow

1. git branch
2. git checkout feature/new-feature
3. git checkout develop
4. git merge feature/new-feature
5. git log
6. git commit commit_id



Master branch -> Production branch
Develop branch -> developing stages

# mlab
- is the largest cloud MongoDB service in the world, hosting over a half million deployments on AWS, Azure and Google.
- is leading DB-as-a-servie for MongoDB, powering a million deployments worldwide.

Comments

Popular posts from this blog

Deploy react app on digitalocean using nginx

Source:  https://www.learnwithjason.dev/blog/deploy-nodejs-ssl-digitalocean/ Source:  https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04 Source:  https://www.youtube.com/watch?v=vRrhQwNixlc https://www.youtube.com/watch?v=pyxXCwgWdMw https://dev.to/xarala221/the-easiest-way-to-deploy-a-react-web-application-2l8a 1. Create a new droplet on DigitalOcean. Choose the $5/month option with Ubuntu 16.04.1 x64. Select a region closest to your users. 2. Finally, add your SSH key and ls -la ~/.ssh # This copies the key so you can paste with command + V pbcopy < ~/.ssh/id_rsa.pub # This prints it in the command line for manual copying cat ~/.ssh/id_rsa.pub   3.  Add your SSH key to the droplet Click “Add SSH Key” to save it, then make sure it’s selected, name your droplet, and hit the big “Create” button to get your server online. Your new droplet will display

Gallery

https://fancyapps.com/fancybox/3/ <!-- 1. Add latest jQuery and fancybox files --> <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" /> <script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script> $ ( function () { if ( $ ( "[data-fancybox]" ). length ){ $ ( "[data-fancybox]" ). fancybox (); } });

Javascript: Array

ARRAY // homogenious and heterogenious array  var a = 'I am here'; var status = true; //array -> multiple values var arr = new Array(); //constructor method var arr1 = []; //bracket notation Example: var hobbies = ['dancing', true, 3423,{ //multiple type data collection values dance: true, singing: false }, []];