LINE FEED AND CARRIAGE RETURN

Line Feed and Carriage Return Explained Line Feed and Carriage Return Explained We all know what a line feed is \n and what a carriage return character is \r . But most of us do not know why we have these two different characters to represent a new line. What does each of them really mean? To start with, these are an emulation of how line ending is handled in a traditional typewriter (hey, I actually worked on one of these :)). Line Feed is the act of moving the cursor exactly one row down, staying at the current column. In a typewriter, this is rolling the page one row up without moving the platen horizontally. Carriage Return is the act of moving the cursor to the beginning of the line, staying on the current row. In a typewriter, this is moving the platen to the right horizontally without rolling the page. The above operation, when done in succession, will make the typing head point to the beginning of the next line...

GIT COMMANDS

Git Revisited

Git Revisited

git add -u

Add all modified files into staging area.

git commit -a

Automatically adds all tracked files to staging area for committing.

git diff --staged

Diff the content already added to staging area (using git add command).

git remote add <alias> <remote git repo location>

Makes a reference to the remote repository with the given name.

Example: git remote add origin https://github.com/deepikakolli4/project123.git

origin acts as an alias to the remote repository.

git remote -v

List all remote repositories aliased.

Example: git remote -v

origin  https://github.com/<your account name>/project123.git (fetch)
origin  https://github.com/<your account name>/project123.git (push)

git fetch <remote alias>

Fetches the remote repo to local but does not merge onto the current branch, instead creates a new remote tracking branch.

git br -a will show all the remote branches in red color

* master
remotes/origin/master

git remote show <remote alias>

Will show the info of all the remote and local branches with respect to the remote repo.

* remote origin
Fetch URL: https://github.com//project123.git
Push URL: https://github.com//project123.git
HEAD branch: master
Remote branch:
  master                tracked
Local ref configured for 'git push':
  master pushes to master (local out of date)

git pull <remote alias> <remote branch>

Fetches the remote repo to local and also merges onto the current branch. Also creates a new remote tracking branch.

git br -a will show all the remote branches in red color

* master
remotes/origin/master

git log will show the detailed commits recreated after the pull.

git push <remote alias> <branch>

Find a ref that matches <branch> in the source repository (most likely, it would find refs/heads/master), and update the same ref (e.g. refs/heads/master) in <remote alias> repository with it. If <branch> did not exist remotely, it would be created.

References: http://gitref.org/

Comments

Popular posts from this blog

LINE FEED AND CARRIAGE RETURN

CSS