GIT COMMANDS
- Get link
- X
- Other Apps
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/
- Get link
- X
- Other Apps
Comments
Post a Comment