-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Git & Git advanced challenge completed WEEK 4 #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e2f21b0
e8c3ccf
03999fe
f8fe987
a4b070a
4b6c852
bd06319
0f00827
a80a4b0
630caf2
f6ec719
fc27e45
70deb2d
5086e36
d4bf418
08c8db6
c823b89
c4c1550
9db334a
6c4070b
9b37683
519d52a
2758a2b
d391cfd
898c1d4
8b3fdfc
a193ecf
2c656e6
c02bd79
894fa70
7c4645d
a49d48d
9a7e8cd
20198b5
93157f9
ae03245
c0804ad
dc62c74
7d5f5b9
a3e6714
d46cb3c
2d57f50
691beda
34b6e6a
3861490
2a2f699
cc7d7b0
a958183
0291085
17e1eaf
7542e91
e2890af
8176f50
232e825
7d2c510
b6fc8d0
732a412
89e462b
dcb7b3f
4ddaff0
5012d18
7da15ff
33238ad
6f6ce2f
f01869b
1c204c5
8b90a7f
619953e
d46007a
00ed7cf
d7d55d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| Hi Myname is Mirza Nikhath Sultana | ||
|
|
||
| I am a post graduate student in statistics right now i am growing my career in DevOps field and learned many DevOps tools | ||
|
|
||
| Linux, GitHub , Shell Scripting , Terraform etc... | ||
|
|
||
| i am looking forward for a job as DevOps Engineer . | ||
|
|
||
| I am so excited to share that i am moving forward and performing my skills better while doing hands on practice on the devops tools like git hub and I am personally enjoying it. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # WEEK 4 :- GIT AND GIT HUB (BASICS) | ||
|
|
||
| # GIT: | ||
| Git is the version control system a tool that tracks changes to files over time. It's commonly used by developers to manage source code. | ||
|
|
||
| # Concepts of Git : | ||
| - Repository: A directory that contains projects files and .git folder to track version history . | ||
| - Commit :A snapshot of your project at a specific point of time . | ||
| - Branch : A parallel version of repository useful for experimenting without effecting the main code. | ||
| - Merge : Combines changes from one branch to another branch. | ||
| - Clone: Git clone copies the remote repository to our local machine . | ||
| - Push: sends your local changes to a remote git repository | ||
| - Pull : Fetches your remote repository changes to your local repository . | ||
|
|
||
| # GITHUB: | ||
| GitHub is a web based platform that hosts Git repositories online. It allows collaboration, version tracking and project management for Git-based projects. | ||
|
|
||
| # Features of GitHub: | ||
| - Remote hosting for git repositories . | ||
| - Collaboration tools like issues, pull requests, and discussions . | ||
| - Open source contribution. | ||
| - CI/CD integration with tools like GitHub Actions . | ||
| - project management . | ||
|
|
||
| Some basic git commands : | ||
|
|
||
| - To initialize Git repository: | ||
|
|
||
| [command : git init] | ||
|
|
||
| - To clone github repository in your local machine : | ||
|
|
||
| [command: git clone <url of repo>] | ||
|
|
||
| - To see the changes made currently : | ||
|
|
||
| [comand: git status ] | ||
|
|
||
| - To stage changes for commit : | ||
|
|
||
| [command: git add .] | ||
|
|
||
| - To commit the changes made : | ||
|
|
||
| [command : git commit -m "commit message"] | ||
|
|
||
| - To push changes to GitHub remote repository : | ||
|
|
||
| [command: git push] | ||
|
|
||
| - To pull changes from GitHub remote repository : | ||
|
|
||
| [command : git pull ] | ||
|
|
||
| - To list all the branches : | ||
|
|
||
| [ command: git branch] | ||
|
|
||
| - To create and switch to a new branch : | ||
|
|
||
| [command: git checkout -b dev] | ||
|
|
||
| - To merge the two branche or dev branch in current branch : | ||
|
|
||
| [command : git merge dev ] | ||
|
|
||
| # TASK 1: FORK AND CLONE THE REPOSITORY | ||
|
|
||
| 1- Forked the repository : | ||
|
|
||
|  | ||
|
|
||
| 2- Clone the forked repository : | ||
|
|
||
|
|
||
|  | ||
|
|
||
| successfully cloned the repository | ||
|
|
||
|
|
||
|  | ||
|
|
||
| 3- change directory into cloned repository : | ||
|
|
||
|
|
||
|  | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # TASK 2:- INITIALIZE A LOCAL REPOSITORY AND CREATE A FILE | ||
|
|
||
| 1- Set Up Your Challenge Directory: | ||
| - Inside the cloned repository, create a new directory for this challenge: | ||
|
|
||
| command : mkdir Week-4-challenge | ||
| command : cd Week-4-challenge | ||
|  | ||
|
|
||
|
|
||
| 2- Create a File inside folder Week-4-challenge : | ||
| - Create a file named info.txt and add some initial content (for example, your name and a brief introduction). | ||
|
|
||
| command : touch info.txt | ||
|  | ||
|
|
||
|
|
||
| 3- Stage and commit your file : | ||
| - Stage the file | ||
|
|
||
| command : git add ./ | ||
|
|
||
|  | ||
|
|
||
|
|
||
|
|
||
| - commit the file with descriptive message : | ||
|
|
||
| command : git commit -m "Initial commit: Add info.txt with introductory content" | ||
|  | ||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Task 3: Configure Remote URL with PAT and Push/Pull | ||
|
|
||
| - Configuring remote URL using PAT(personal access token) | ||
|
|
||
| command: git remote add origin https://<your-username>:<your-PAT>@github.com/<your-username>/90DaysOfDevOps.git | ||
|
|
||
| In the above command i have changed it as | ||
|
|
||
| command : git remote add origin https://mirzanikhath:<my PAT>@github.com/mirzanikhath/90DaysOfDevOps.git | ||
|
|
||
| But it shows Origin already exists.then i used the below command to set the URL | ||
|
|
||
| command : git remote set-url origin https://mirzanikhath:<myPAT>@github.com/mirzanikhath/90DaysOfDevOps.git | ||
|
|
||
|  | ||
|
|
||
| - Pushing my Commit to Remote: | ||
|
|
||
| command : git push -u origin main | ||
|
|
||
|  | ||
|
|
||
|
|
||
|
|
||
| The above image shows my terminal where I'm trying to push the code to remote GitHub repository, but running into an issue and here's the breakdown how i solved it step by step | ||
|
|
||
| when i run the command of git push | ||
|
|
||
| command : git push -u origin master | ||
|
|
||
| I got an error like | ||
|
|
||
| error: failed to push some refs to ..... | ||
| hint : Updates were rejected because the tip of my current branch is behind its remote counterpart . | ||
|
|
||
| Which means Git is refusing to pysh because the localk master branch is behind the remote master branch.So i have done pulling the code first to sync the changes . | ||
|
|
||
|  | ||
|
|
||
|
|
||
|
|
||
| Now when I run git pull command the error occured as the changes need to be made in both local and remote git repository so I used rebase command here , which uses merge startegy to make changes both in local and remote repository . | ||
|
|
||
| command : git config pull.rebase false | ||
|
|
||
| After running this command it finally pulled and pushed the code to github. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Task 4: Explore Your Commit History | ||
|
|
||
| - View the commit history : | ||
|
|
||
| To view the commit history we use git log command to check the latest commit made to the branch | ||
|
|
||
| command : git log | ||
|
|
||
| The below image shows the latest commit made by me on the master branch | ||
|
|
||
|  |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Task 5: Advanced Branching and Switching | ||
|
|
||
| - Created a new branch feature-update and switched to that branch by using | ||
|
|
||
| command : git checkout -b feature-update | ||
|
|
||
|  | ||
|
|
||
|
|
||
| - Modified the File info.txt and Committed Changes to the new branch and further pushed to remote github repository : | ||
|
|
||
| command :git add info.txt | ||
| git commit -m "Feature update: Enhance info.txt with additional details" | ||
| git push origin feature-update | ||
|  | ||
|
|
||
|  | ||
|
|
||
|
|
||
| - merging the feature-update branch with master branch through creating a pull request on github | ||
|
|
||
| # Step-1: | ||
| Go to pull requests click on New pull request option which is in green color | ||
|
|
||
|  | ||
|
|
||
| # Step-2: | ||
| Enter the base branch in which we have to merge our compare branch as you can see below . | ||
|
|
||
| base branch:master compare branch:feature-update | ||
|
|
||
| then click on create pull request option. | ||
|
|
||
|  | ||
|
|
||
| # Step -3: | ||
| The page will be displayed as shown in the figure below which gives us breif about what are being merged from feature-update branch into master branch and verify the conflicts present if no conflicts are present then click on merge pull request option. | ||
|
|
||
|  | ||
|
|
||
| # Step-4: | ||
| Finally the feature-update branch is being merged in master branch . Now we can easily delete the feature-update branch if we want . | ||
|
|
||
|  | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Task 6: Explain Branching Strategies | ||
|
|
||
| From task 1-5 git commands which I have used are : | ||
|
|
||
| - For cloning the repository in out local machine i used | ||
|
|
||
| command : git clone | ||
|
|
||
| - For initializing a git repository i used | ||
|
|
||
| command : git init | ||
|
|
||
| - For checking the status of the work i used | ||
|
|
||
| command : git status | ||
|
|
||
| - For making the file unstaged I used | ||
|
|
||
| command : git add . | ||
|
|
||
| - For commiting the changes applied I used | ||
|
Comment on lines
+5
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Correct terminology and grammar in command descriptions
- For cloning the repository in out local machine i used
+For cloning the repository **on our** local machine I used
- For making the file unstaged I used
- command : git add .
+To **stage** all current changes I used
+```bash
+git add .
+```
...
- command : git remote origin <URL>
+```bash
+git remote add origin <URL>
+```🧰 Tools🪛 LanguageTool[uncategorized] ~5-~5: The preposition “on” seems more likely in this position than the preposition “in”. (AI_EN_LECTOR_REPLACEMENT_PREPOSITION_IN_ON) [uncategorized] ~5-~5: “out” (outside) seems less likely than “our” (belonging to us). (AI_HYDRA_LEO_CP_OUT_OUR) [uncategorized] ~5-~5: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA) [uncategorized] ~9-~9: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA) [uncategorized] ~13-~13: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA) [uncategorized] ~17-~17: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA) [uncategorized] ~21-~21: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA) 🤖 Prompt for AI Agents |
||
|
|
||
| command : git commit -m " commit message" | ||
|
|
||
| - For connecting github locally through remote url | ||
|
|
||
| command : git remote origin <URL> | ||
|
|
||
| - For setting up the URL | ||
|
|
||
| command : git remote set-url origin <URL> | ||
|
|
||
| - For pushing the code to GitHub | ||
|
|
||
| command : git push origin <branchname> | ||
|
|
||
| - For fetching the code from GitHub | ||
|
|
||
| command : git pull -u origin <branchname> | ||
|
|
||
| - For making the branch upto date for push and pull of code rebase command | ||
|
|
||
| command : git config pull.rebase false | ||
|
|
||
| - For checking the commit history | ||
|
|
||
| command : git log | ||
|
|
||
| - For creating a new branch | ||
|
|
||
| command : git checkout -b <newbranchname> | ||
|
|
||
| # Why branching strategies are important | ||
|
|
||
| Branching strategy help teams to managed code changes in a structured way , especially when multiple developers are working on the same project. | ||
|
|
||
| Key Benefits : | ||
|
|
||
| - Isolating features and bug fixes : | ||
| Developers can work on new features or bug fixes in separate branches without effecting the main code base . | ||
|
|
||
| - Facilitating parallel development : | ||
| Multiple branches helps the team members to work on different tasks without interfering with each other . | ||
|
|
||
| - Reducing merge conflicts : | ||
| By organizing work in different branches and merging regularly , the risk of large merge conflicts is reduced . | ||
|
|
||
| - Enabling effective code reviews : | ||
| Changes can be reviewed by creating a pull requests before merging into the main branch,improving code quality and team collaboration . | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Task 1: Working with Pull Requests (PRs) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filename is misspelled ( 🤖 Prompt for AI Agents |
||
|
|
||
| # Pull request : | ||
| A pull request is a way to propose changes you've made in a branch to be merged into another branch, usually the main branch of a project. | ||
|
|
||
| In simple terms the pull request means you make changes -> push them to GitHub-> you open a pull request -> others can review the changes -> if approved, it gets merged into the main branch. | ||
|
|
||
| Why its called a "pull" request? | ||
|
|
||
| Because you're asking the repository owner (or team) to pull the chnages into their branch . | ||
|
|
||
| Example: | ||
| - you create a new branch called feature-login. | ||
| - you add login functionality and commit the code . | ||
| - you push the feature-login to GitHub. | ||
| - you open a pull request to merge feature-login into main . | ||
| - your team members review the PRs , give feedback or approve it . | ||
| - once, approved its merged into the main branch or codebase. | ||
|
|
||
| # Benefits of PRs: | ||
| - Enables code reviews . | ||
| - Keeps main branch clean and stable. | ||
| - Allows for discussion and collaboration . | ||
| - Tracks changes , comments and approvals . | ||
|
|
||
| 1- Fork a repository and clone it locally : | ||
|  | ||
|  | ||
|
|
||
|
|
||
| command : git clone https://github.com/mirzanikhath/fairfield-programming.github.io.git | ||
|
|
||
| command: cd fairfield-programming.github.io | ||
|  | ||
|  | ||
|
|
||
|
|
||
| 2- Create a feature branch and make changes . | ||
|  | ||
|
|
||
|
|
||
| command : git checkout -b feature-branch | ||
|
|
||
| created a new file feature.txt and append a line into it | ||
|
|
||
| command : echo "New Feature" >> feature.txt | ||
|
|
||
| to add this file | ||
|
|
||
| command : git add . | ||
|
|
||
| to commit the chnages | ||
|
|
||
| command : git commit -m "added new feature" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not embed Personal Access Tokens directly in remote URLs
Storing the PAT in plain text leaks credentials via shell history, screenshots, and
.git/config. Recommend using Git credential helpers or environment variables.🧰 Tools
🪛 LanguageTool
[uncategorized] ~7-~7: Possible missing comma found.
Context: ...rname>/90DaysOfDevOps.git In the above command i have changed it as command ...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~7-~7: Did you mean “I”?
Context: ...0DaysOfDevOps.git In the above command i have changed it as command : ...
(I_LOWERCASE_PREMIUM)
[uncategorized] ~11-~11: A punctuation mark might be missing here.
Context: ... But it shows Origin already exists.then i used the below command to set the URL ...
(AI_EN_LECTOR_MISSING_PUNCTUATION)
🤖 Prompt for AI Agents