Git Workflow
- Developer:
- For developing features
- For fixing issues
- Tester:
- Automation Testers develop test scripts for automation
-
DevOps:
- For maintaining DevOps Pipelines
- For storing
- K8s manifests
- Dockerfiles
- Terraform templates/modules
- Ansible playbooks etc.
-
Ways of Working
- GUI (Graphical User interface)
- Commandline
Approach
- Lets learn git
- with single system
- Add Remote (GitHub, Azure Source Repos, AWS CodeComit)
- Branching Strategies
- Hooks
Single System
- Configurations
- Creating local repositories
- How to work for multiple customers/versions
To understand Git Simulate Developer
- Lets create a configuration
- On every git commit (label on carton box)
- Who has done the change
- name
- When did the change happen
- What was changed
- What is the message (label)
- Who has done the change
Git configurations
- Git has configurations of three types
- System Config
- Global config
- local config
- The configuration is a text file
key=value
- Generally for user level information we use Global config
- If there is a config special to a repository we use local config
- To deal with configurations we have command
git config --help
- Lets add a username and user email config at global level
git config --global user.name qtdevops
git config --global user.email qtdevops@gmail.com
Create a Repository
- Create an empty folder
mkdir C:\temp\LearningGit\ltsalesman
cd C:\temp\LearningGit\ltsalesman
- Now initalize the folder with git init to make it a git repository
git init
Create commits
- Lets do some changes and execute
git status
- git status command tries to show the status w.r.t to changes
- lets add all the changes to staging area
git add .
- lets check status
git status
* Now lets add all the changes from staging area into commit
git commit -m "<message>"
git status
* Lets view the commits
git log
Git deals with changeset (change)
- Lets create two changes
- one change in existing file (modified)
- one new file (untracked)
- untracked files in git status represent a new file add which was never part of history or commits
- Now lets add all the changes to staging area and them comit
git add --all
* Lets view history
* Lets draw an tree view of git
Note
- Home Directory:
- Windows:
C:\users\<username>
- Mac:
/Users/<username>
- Linux:
/home/<username>
- Windows:
- Refer Here for installing necessary softwares in Windows
- IDE (Integrated Developer Environment)
- Eclipse/IntelliJ (Java)
- Visual Studio (.net)
- PyCharm/Spyder (python)
- Visual Studio Code (any language)
- We will be using visual studio code