Bootstrap and Git Example

Name of Innovation

Bootstrap and Git Example

January 7, 2019 Uncategorized 0

Bootstrap

Sample Bootstrap code :

 

<!DOCTYPE html>
<html lang="en">
<head>
 <title>Bootstrap Example</title>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<h1 align="center">Bootstrap Examples</h1>
<div class="container">
 <h2>Bootstrap Table</h2>
 <table class="table table-striped">
 <thead>
 <tr>
 <th>Firstname</th>
 <th>Lastname</th>
 <th>Email</th>
 </tr>
 </thead>
 <tbody>
 <tr>
 <td>Amar</td>
 <td>Sharma</td>
 <td>amar@gmail.com</td>
 </tr>
 <tr>
 <td>Mohan</td>
 <td>Chary</td>
 <td>mohan@example.com</td>
 </tr>
 <tr>
 <td>Neeraj</td>
 <td>Nagori</td>
 <td>neeraj@example.com</td>
 </tr>
 </tbody>
 </table>
</div>

<br></br>

<div class="container">
 <h2>Alerts</h2>
 <div class="alert alert-success">
 <strong>Success!</strong> WOIR alert for success status.
 </div>
 <div class="alert alert-info">
 <strong>Info!</strong> WOIR alert for information status.
 </div>
 <div class="alert alert-warning">
 <strong>Warning!</strong> WOIR alert for warning status.
 </div>
 <div class="alert alert-danger">
 <strong>Danger!</strong> WOIR alert for danger/error status.
 </div>
</div>
<br><br>

<div class="container">
 <h2>Button Styles</h2>
 <button type="button" class="btn">Basic</button>
 <button type="button" class="btn btn-default">Default</button><br></br>
 <button type="button" class="btn btn-primary">Primary</button>
 <button type="button" class="btn btn-success">Success</button><br></br>
 <button type="button" class="btn btn-info">Info</button>
 <button type="button" class="btn btn-warning">Warning</button>
 <button type="button" class="btn btn-danger">Danger</button>
 <button type="button" class="btn btn-link">Link</button> 
</div>

<br></br>
<div class="container">
 <h2>Bootstrap Grid System</h2>
 <p>Resize the browser window to see the effect.</p>
 <p>The columns will automatically stack on top of each other when the screen is less than 768px wide.</p>
 <div class="row">
 <div class="col-md-4" style="height:100px;background-color:lavender;">.col-sm-4</div>
 <div class="col-sm-4" style="height:100px;background-color:lavenderblush;">.col-sm-4</div>
 <div class="col-sm-4" style="height:100px;background-color:lavender;">.col-sm-4</div>
 </div>
 <div class="row">
 <div class="col-md-3" style="height:100px;background-color:#8a6d3b;">.col-sm-3</div>
 <div class="col-sm-3" style="height:100px;background-color:#dff0d8;">.col-sm-3</div>
 <div class="col-sm-3" style="height:100px;background-color:#555;">.col-sm-3</div>
 <div class="col-sm-3" style="height:100px;background-color:#f2dede;">.col-sm-3</div>
 </div>
</div>
<br></bt>

</body>
</html>

 

GIT

Git sample commands:

Create a repository on your git accounts, run the clone command on your terminal.

eg: git clone git@github.com:username/example_git.git

cd example_git

create one sample file (eg: woir_testing.txt ) and write some content in that file.

after creating file, add that file to git using below command.

git add woir_testing.txt 

or 

git add -A     ####This command will add all the files present in this directory

Before going  to the commit command, run the below command and edit name and email id, if those lines are commented uncommet the lines.

git config --global --edit

After adding, commit the file using below command.

git commit -m "write some meaningfull text"

Now  push to the git.

git push origin master

If we want to check older version, run the following command it will show the all versions

git log

example output:
commit c436a7a86576aac5besdsdsgfr370ab8907b4aa1a109
Author: one-shot-finish <amar@woir.in>
Date: Tue Jan 30 05:25:12 2018 -0500

 rpm is working

commit b9c135f3ffcc3casdfdsfssde2948e5313645089c69
Author: one-shot-finish <amar@woir.in>
Date: Thu Jan 25 10:18:06 2018 -0500

 all scripts are added

If we wnat to go back to the old version run the command

git reset --hard c436a7a86576aac5besdsdsgfr370ab8907b4aa1a109
or 
git checkout c436a7a86576aac5besdsdsgfr370ab8907b4aa1a109

 

 

 


Live Example

Apples-MacBook-Pro:deleteme amars$ mkdir test

Apples-MacBook-Pro:deleteme amars$ cd test

Apples-MacBook-Pro:test amars$ git init

Initialized empty Git repository in /Users/amars/deleteme/test/.git/

Apples-MacBook-Pro:test amars$ vi hello.txt

Apples-MacBook-Pro:test amars$ git add hello.txt 

Apples-MacBook-Pro:test amars$ git commit -m "My first file"

[master (root-commit) 4a7dea7] My first file

 Committer: Amar Sharma <amars@Apples-MacBook-Pro.local>

Your name and email address were configured automatically based

on your username and hostname. Please check that they are accurate.

You can suppress this message by setting them explicitly. Run the

following command and follow the instructions in your editor to edit

your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 3 insertions(+)

 create mode 100644 hello.txt

Apples-MacBook-Pro:test amars$  git config --global --edit

Apples-MacBook-Pro:test amars$ git commit -m "My first file"

On branch master

nothing to commit, working tree clean

Apples-MacBook-Pro:test amars$ git status

On branch master

nothing to commit, working tree clean

Apples-MacBook-Pro:test amars$ vi 

.git/      hello.txt 

Apples-MacBook-Pro:test amars$ vi 

.git/      hello.txt 

Apples-MacBook-Pro:test amars$ vi hello.txt 

Apples-MacBook-Pro:test amars$ git add -A .

Apples-MacBook-Pro:test amars$ git commit -m "My second  file"

[master 6d46e62] My second  file

 1 file changed, 3 insertions(+)

Apples-MacBook-Pro:test amars$ vi hello.txt 

Apples-MacBook-Pro:test amars$ git add -A .

Apples-MacBook-Pro:test amars$ git commit -m "My third  file"

[master 3c180be] My third  file

 1 file changed, 3 insertions(+)

Apples-MacBook-Pro:test amars$ git log

commit 3c180bec7d21620adf95d43d507597d8311988e4 (HEAD -> master)

Author: Amar Sharma <amar@woir.in>

Date:   Mon Jan 7 19:30:33 2019 +0530

    My third  file

commit 6d46e622c5affb096bdfd62acd7c00d73e5197e6

Author: Amar Sharma <amar@woir.in>

Date:   Mon Jan 7 19:29:59 2019 +0530

    My second  file

commit 4a7dea7ecfc06c1f979c2ff1b832c1a5e3a891e5

Author: Amar Sharma <amars@Apples-MacBook-Pro.local>

Date:   Mon Jan 7 19:27:55 2019 +0530

    My first file

Apples-MacBook-Pro:test amars$ git checkout 4a7dea7ecfc06c1f979c2ff1b832c1a5e3a891e5

Note: checking out '4a7dea7ecfc06c1f979c2ff1b832c1a5e3a891e5'.

You are in 'detached HEAD' state. You can look around, make experimental

changes and commit them, and you can discard any commits you make in this

state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may

do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 4a7dea7 My first file

Apples-MacBook-Pro:test amars$ pwd

/Users/amars/deleteme/test

Apples-MacBook-Pro:test amars$ vi hello.txt 

Apples-MacBook-Pro:test amars$ git checkout

Apples-MacBook-Pro:test amars$ vi hello.txt 

Apples-MacBook-Pro:test amars$ git log

commit 4a7dea7ecfc06c1f979c2ff1b832c1a5e3a891e5 (HEAD)

Author: Amar Sharma <amars@Apples-MacBook-Pro.local>

Date:   Mon Jan 7 19:27:55 2019 +0530

    My first file

Apples-MacBook-Pro:test amars$ git checkout 3c180bec7d21620adf95d43d507597d8311988e4

Previous HEAD position was 4a7dea7 My first file

HEAD is now at 3c180be My third  file

Apples-MacBook-Pro:test amars$ !v

vi hello.txt 

Apples-MacBook-Pro:test amars$ git checkout 4a7dea7ecfc06c1f979c2ff1b832c1a5e3a891e5

Previous HEAD position was 3c180be My third  file

HEAD is now at 4a7dea7 My first file

Apples-MacBook-Pro:test amars$ vi hello.txt 

Apples-MacBook-Pro:test amars$ git log

commit 4a7dea7ecfc06c1f979c2ff1b832c1a5e3a891e5 (HEAD)

Author: Amar Sharma <amars@Apples-MacBook-Pro.local>

Date:   Mon Jan 7 19:27:55 2019 +0530

    My first file

Apples-MacBook-Pro:test amars$ git branch

* (HEAD detached at 4a7dea7)

  master

Apples-MacBook-Pro:test amars$ git checkout master

Previous HEAD position was 4a7dea7 My first file

Switched to branch 'master'

Apples-MacBook-Pro:test amars$ !v

vi hello.txt 

Apples-MacBook-Pro:test amars$ git branch b1

Apples-MacBook-Pro:test amars$ git checkout b1

Switched to branch 'b1'

Apples-MacBook-Pro:test amars$ git status

On branch b1

nothing to commit, working tree clean

Apples-MacBook-Pro:test amars$ git checkout master

Switched to branch 'master'

Apples-MacBook-Pro:test amars$ git status

On branch master

nothing to commit, working tree clean

Apples-MacBook-Pro:test amars$ git checkout b1

Switched to branch 'b1'

Apples-MacBook-Pro:test amars$ vi hello.txt 

Apples-MacBook-Pro:test amars$ git add hello.txt 

Apples-MacBook-Pro:test amars$ git commit -m "Commiting to the branch"

[b1 f84272d] Commiting to the branch

 1 file changed, 3 insertions(+)

Apples-MacBook-Pro:test amars$ git status

On branch b1

nothing to commit, working tree clean

Apples-MacBook-Pro:test amars$ git checkout master

Switched to branch 'master'

Apples-MacBook-Pro:test amars$ vi hello.txt 

Apples-MacBook-Pro:test amars$ git checkout b1

Switched to branch 'b1'

Apples-MacBook-Pro:test amars$ vi hello.txt 

Apples-MacBook-Pro:test amars$ git checkout master

Switched to branch 'master'