Linux by Ripudaman Singh

Image
Customize the Bash [Linux] Your terminal window generally has username@hostname but you can change that we will discuss here how to change it.   link for details: Read-1 Read-2 Read-3 Let's make the Example setup as in above picture with live time cp ~/.bashrc ~/.bashrc.bak  In case of a problem it will help to get back the old file  nano ~/.bashrc Add the follwing line at the Last PS1="\e[0;35m\w\e[m\n\@ \e[0;35m$\e[m " close the nano by ctrl X, Y enter. making Changes active by source ~/.bashrc To customize in your own way see the above links. Get the localhost at some other name [Linux] Open your terminal and type  sudo nano /etc/hosts map your name with localhost address like 127.0.0.1       localhost 127.0.1.1       ripudaman # The following lines are desirable for IPv6 capable hosts ::1 ctrl X, y enter All done you can access the localhost at your describe name for me its ripudaman (helpful when making twitt...

GIT tool for GITHUB/

Get straight to the topic:


--> Github is a platform where we can create your rapo and work in a group efficiently.

1)  create an account at the GitHub
2)  create a rapo (needs simple form filling skills or refer youtube)
3)  (for Ubuntu) sudo apt-get install git(a tool for interacting, posting, getting data, at GitHub)
4)  mkdir <directory name>
5)  cd <directory name>
6) git init
7) git config -- user.name "   "
9) git config -- user.email"   "
10) create a file and save it
11)  add the file
12)  commit the file
13) push the file to the server
14) merge the branch/ pull data change/ continue work



commands of GIT:

Push changes to remote repository (remembered branch)
git push

Delete a remote branch
git push origin --delete [branch name]

Update local repository to the newest commit
git pull

Pull changes from remote repository
git pull origin [branch name]

Add a remote repository
git remote add origin ssh://git@github.com/[username]/[repository-name].git

Set a repository's origin branch to SSH
git remote set-url origin ssh://git@github.com/[username]/[repository-name].git

Inspection & Comparison

View changes
git log

View changes (detailed)
git log --summary

Preview changes before merging
git diff [source branch] [target branch}

Getting & Creating Projects


Initialize a local Git repository
git init

Create a local copy of a remote repository
git clone ssh://git@github.com/[username]/[repository-name].git

Basic Snapshotting

Check status
git status

Add a file to the staging area
git add [file-name.txt]

Add all new and changed files to the staging area
git add -A

Commit changes
git commit -m "[commit message]"

Remove a file (or folder)
git rm -r [file-name.txt]

Branching & Merging


List branches (the asterisk denotes the current branch)
git branch


List all branches (local and remote)
git branch -a


Create a new branch
git branch [branch name]


Delete a branch
git branch -d [branch name]


Delete a remote branch
git push origin --delete [branchName]


Create a new branch and switch to it
git checkout -b [branch name]


Clone a remote branch and switch to it
git checkout -b [branch name] origin/[branch name]


Switch to a branch
git checkout [branch name]


Switch to the branch last checked out
git checkout -


Discard changes to a file
git checkout -- [file-name.txt]


Merge a branch into the active branch
git merge [branch name]


Merge a branch into a target branch
git merge [source branch] [target branch]


Stash changes in a dirty working directory
git stash


Remove all stashed entries
git stash clear

Sharing & Updating Projects

Push a branch to your remote repository
git push origin [branch name]


Push changes to remote repository (and remember the branch)
git push -u origin [branch name]


THANKS FOR READING

Comments

Post a Comment

Popular posts from this blog

Linux by Ripudaman Singh

CS IT PDFS