Skip to content
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

Pull request attempt #26

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 35 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@
# this is a playground repository for cohort 5
# This is a playground repository for Cohort 5

## This is Darshan's Version
## This is Zaryab's, Darshan's, and Simeon's Version

## This is Simeon's Version

Session #3: Git & GitHub

Initializing a Repository
- Create a new Git repository: git init
- Create a new branch called main while initializing: git init -b main
Cloning a Repository
Clone an existing repository: git clone <repository_url>
Clone and rename the directory: git clone <repository_url> <new_directory_name>

- Cloning a Repository
- Clone an existing repository: git clone <repository_url>
- Clone and rename the directory: git clone <repository_url> <new_directory_name>

Tracking Files
Check the status of your repository: git status
Track a new file: git add <file_name>
Track all files: git add -A
- Check the status of your repository: git status
- Track a new file: git add <file_name>
- Track all files: git add -A

Committing Changes
Commit staged changes with a message: git commit -m "Your commit message"
Commit without -m for a detailed message: git commit (Enter the message in the editor)
- Commit staged changes with a message: git commit -m "Your commit message"
- Commit without -m for a detailed message: git commit (Enter the message in the editor)

Remote Repositories
Check remotes: git remote -v
Add a remote repository: git remote add origin <repository_url>
Show details of a remote: git remote show origin
Fetching, Pulling, and Pushing
Fetch updates from the remote repository: git fetch origin
Fetch and merge updates (pull): git pull origin <branch_name>
Pull with rebase to update local branch: git pull –rebase origin <branch_name>
Push changes to the remote repository: git push origin <branch_name>
- Check remotes: git remote -v
- Add a remote repository: git remote add origin <repository_url>
- Show details of a remote: git remote show origin
- Fetching, Pulling, and Pushing
- Fetch updates from the remote repository: git fetch origin
- Fetch and merge updates (pull): git pull origin <branch_name>
- Pull with rebase to update local branch: git pull –rebase origin <branch_name>
- Push changes to the remote repository: git push origin <branch_name>

Branching
List all branches: git branch -v
Create a new branch: git branch <new_branch_name>
Switch to a branch: git checkout <branch_name/commit id>
Create and switch to a branch: git checkout -b <new_branch_name>
Merge a branch into the current branch: git merge <branch_name>
Delete a branch: git branch -d <branch_name>
- List all branches: git branch -v
- Create a new branch: git branch <new_branch_name>
- Switch to a branch: git checkout <branch_name/commit id>
- Create and switch to a branch: git checkout -b <new_branch_name>
- Merge a branch into the current branch: git merge <branch_name>
- Delete a branch: git branch -d <branch_name>

Branching Workflow
Switch to a new branch: git checkout -b feature-branch
Make changes, stage, and commit:
- Switch to a new branch: git checkout -b feature-branch
- Make changes, stage, and commit:
git add -A
git commit -m "Feature updates"
Push the branch: git push origin feature-branch
- Push the branch: git push origin feature-branch

Merge Conflicts
If conflicts occur, Git will pause and show conflict markers (<<<<, =====, >>>>) in affected files. Manually resolve the conflict by editing the file.
Then: git add <file_name>
- If conflicts occur, Git will pause and show conflict markers (<<<<, =====, >>>>) in affected files. Manually resolve the conflict by editing the file.
- Then: git add <file_name>
git commit