Git Command
Git Command
Basic Architecture
Configuration management(CM) is managing the configuration of all of the project's key products and
assets.
SCM stands for Source Code Management is an integral part of any project in the IT world.
Source Code Management or Version Control Systems in any project ensure all the members of a team
stay on top of the source code changes.
GitLab - Continuous Integration (CI), Continuous Delivery (CD) is an integral part of GitLab
Bitbucket Server:
Subversion (SVN):
Collaboration- Without a SCM in place, you're probably working together in a shared folder on the same
set of files. It's extremely error prone, someone will overwrite someone else's changes. With a SCM,
everybody on the team is able to work absolutely freely - on any file at any time.
Storing Versions
Understanding What Happened: Every time you save a new version of your project, your SCM requires
you to provide a short description of what was changed. This helps you understand how your project
evolved between versions.
Backup
Git is a version control system that lets you manage and keep track of your source code history.
GitHub is a cloud-based hosting service that lets you manage Git repositories.
Repository: You can simply, treat it as a storage area of your workplace that contains all your
documentation files and the history of changes.
Clone: Clones are literally clones (copies) of a repository that sit on the developer’s computer instead of
a server elsewhere.
Commit: Whatever the changes you make in your files will come under commit. Every change is saved
under a particular name or ID which is also called “revision”.
Push: Pushing refers to sending your committed changes to a remote repository such as GitHub.com.
Pull Request: If you have made changes in code/script, to show the other collaborators you send a pull
request.
Fork: It is a copy of other's repository in your account in which you can make changes and it won't affect
the original code.
Branching: When you extract a portion /section of code from the main or remote track of your software,
then it is called ‘branch' and the process is known as Branching.
Fetch: Fetching refers to getting the latest changes from an online repository (like GitHub.com) without
merging them in.
Merge: Merging takes the changes from one branch (in the same repository or from a fork), and applies
them into another.
1. git config
This command sets the author name and email address respectively to be used with your commits.
Example:
2. git init
git init
3. git clone
Example: navigate to your repo path where you want to clone and write below command in cmd
4. git add
Example:
git add *
git add .
5. git commit
This command records or snapshots the file permanently in the version history.
Example:
6. git diff
This command shows the file differences which are not yet staged.
Example:
7. git reset
This command unstages the file, but it preserves the file contents.
8. git status
git status
9. git rm
This command deletes the file from your working directory and stages the deletion.
git rm [file]
git branch
This command lists all the local branches in the current repository.
Example:
git master
11. git log
git log
This command is used to list the version history for the current branch.
Example:
This command merges the specified branch’s history into the current branch.
This command is used to connect your local repository to the remote server.
Example:
This command sends the committed changes of master branch to your remote repository.
Example:
This command fetches and merges changes on the remote server to your working directory.
Example:
This command shows the metadata and content changes of the specified commit.
Example:
17. Checkout
This command is used to switch from one branch to another or You can get the specific previous version.
Example: