Git Commands

 1.

Git taskNotesGit commands
Tell Git who you areConfigure the author name and email address to be used with your commits.

Note that Git strips some characters (for example trailing periods) from user.name.

git config --global user.name "Sam Smith"

git config --global user.email sam@example.com


2.
3.
Add filesAdd one or more files to staging (index):
git add <filename>

git add *

for total stage - git add *
for specific stage - git add <specific path location>

4.
CommitCommit changes to head (but not yet to the remote repository):
git commit -m "Commit message"

5.
StatusList the files you've changed and those you still need to add or commit:
git status

6.
Connect to a remote repositoryIf you haven't connected your local repository to a remote server, add the server to be able to push to it:git remote add origin <server>

7.For New Branch
BranchesCreate a new branch and switch to it:
git checkout -b <branchname>

8.
Switch from one branch to another/for branch checkout also:
git checkout <branchname>

9.
Push the branch to your remote repository, so others can use it:
git push origin <branchname>

10.
Update from the remote repositoryFetch and merge changes on the remote server to your working directory:git pull

11.
To merge a different branch into your active branch:
git merge <branchname>

12.
Delete the feature branch:
git branch -d <branchname>

Comments