3 Git Operations
3 Git Operations
Lo Mapped: LO1,LO2
Theory:
git config
Usage: git config –global user.name “[name]”
This command sets the author name and email address respectively to be used with your
Commits.
git init
Usage: git init [repository name]
git clone
Usage: git clone [url]
This command is used to obtain a repository from an existing URL.
git add
Usage: git add [file]
This command adds a file to the staging area.
g area.
git commit
Usage: git commit -m “[ Type in the commit message]”
This command records or snapshots the file permanently in the version history.
git diff
Usage: git diff
This command shows the file differences which are not yet staged.
git reset
Usage: git reset [file]
This command unstages the file, but it preserves the file contents.
git rm
Usage: git rm [file]
This command deletes the file from your working directory and stages the deletion.
git log
Usage: git log
This command is used to list the version history for the current branch.
This command shows the metadata and content changes of the specified commit.
git tag
Usage: git tag [commitID]
git checkout
Usage: git checkout [branch name]
This command is used to switch from one branch to another.
git merge
Usage: git merge [branch name]
This command merges the specified branch’s history into the current branch.
git remote
Usage: git remote add [variable name] [Remote Server Link]
This command is used to connect your local repository to the remote server.
git push
Usage: git push [variable name] master
This command sends the committed changes of master branch to your remote repository.
Usage: git push [variable name] [branch]
This command sends the branch commits to your remote repository.
git pull
Usage: git pull [Repository Link]
This command fetches and merges changes on the remote server to your working directory.
git stash
Usage: git stash save
Conclusion: In this assignment we performed various git operations and implemented it in the git
and github account and saw the changes.