Important Commands of Git.
1)What is Git?
2)Why should we use git and GitHub?
3)How to Download?
- How to create a git Directory?
- How to Stage?
- How to do your first Commit?
5)Important Git commands?
1. Git- Git is a version control system (VCS) that lets you manage and keep track of your changes that you make to files.
2. Why we use:- GitHub is a website for hosting projects that use git.
Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all be merged into one source.
3. Download- Click the Blue mark download this will take you to the download page of git.
4. Git Operations -There are main three operations that every programmer have to do in Git.
6. Git commands - The most used commands are
Create a new local repository
Clone an existing Repository
git clone ssh://email@example.com/repo.git
Change files in your working directory
Changes to tracked files
Add all current changes to the next commit
git add .
Add some changes in <file> to the next commit
git add -p <file>
Commit all local changes in tracked files
git commit -a
Commit previously staged changes
Change the last commit
Don't amend published comments
git commit --amend
Show all commits , starting with newest
Show changes over time for a specific file
git log -p <file>
Who changed what and when in <file>
git blame <file>
iv) BRANCHES & TAGS
List of all existing branches
git branch -av
Switch HEAD branch
git checkout <branch name>
Create a new branch based on your current HEAD
git branch <new-branch>
Create a new tracking branch based on a remote branch
git checkout --track <remote/branch>
Delete a local branch
git branch -d <branch name>
Mark the current commit with a tag
git tag <tag-name>
v) Update & Publish
List of all Currently configured remotes
git remote -v
Show information about a remote
git remote show <remote>
Add new remote repository ,named <remote>
git remote add <shortname> <url>
Download all changes from <remote>, but don't integrate into HEAD
git fetch <remote>
Pull all changes from remote, merge/intregrate into HEAD
git pull <remote> <branch name>
Publish local changes on a remote
git push <remote> <branch name>
Delete a branch on the remote
git branch -dr <remote/branch name>
Publish your tags
git push --tags
vi) MERGE & REBASE
MERGE <BRANCH> INTO YOUR CURRENT HEAD
git merge <branch name>
Rebase your current HEAD onto <branch>
_Don't rebase publish commits _
git rebase <branch>
Abort a rebase
git rebase --abort
Continue a rebase after resolving conflicts
git rebase --continue
Use your configured mege tool to solve conflicts
Discard all local changes in your working directory
git reset --hard HEAD
Discard local changes in a specific file
git checkout HEAD <file>
Revert a commit
git revert <commit>
Reset your HEAD pointer to a previous commit
git reset --hard <commit>
Preserve all changes as unstaged changes
git reset <commit>
Preserve uncommitted local changes
git reset --keep <commit>
Latest comments (0)