Git & GitHub– Assignment– 3
Basic Questions
- Create a new repository on GitHub named myrepo and copy the remote URL.
- Run the command to add a remote origin to an existing local repo.
- Show command to verify which remotes are linked with your repository.
- Push the main branch to GitHub for the first time.
- Show the command to push a new local branch called feature1 to remote.
- Clone a repository from https://github.com/test/project.git into your machine.
- Show the command to clone a repo into a specific folder project-folder.
- Pull the latest changes from the remote main branch.
- Show the command to fetch changes from all remote branches.
- Run command to view all remote-tracking branches in your local repo.
- Show how to rename a remote from origin to upstream.
- Run command to remove a remote named testremote.
- Show the git command to list all starred repositories of your account (GitHub CLI).
- Fork a repository from GitHub UI and then clone it into your system (write command for clone).
- Show how to push commits from local dev branch to remote dev.
- Write command to set upstream for a branch feature-login.
- Show command to check if your local branch is ahead/behind remote.
- Push only a single commit with commit hash abc123 to GitHub.
- Run command to delete a remote branch bugfix-1.
- Show command to check remote repository URL of origin.
Intermediate Questions
- Create a new repo locally, connect it to GitHub, push code, and confirm with a command.
- Run command sequence to fork a repo → clone it → push new branch → open PR.
- Show how to create a pull request from feature-2 to main branch (GitHub CLI).
- Fetch updates from remote but don’t merge, then show the difference with your local branch.
- Write command sequence to resolve remote-tracking conflict using rebase.
- Run command to fetch only branch develop from a remote repo.
- Show command to list open pull requests using GitHub CLI.
- Create a label called urgent in GitHub repository using CLI.
- Run command to assign yourself to issue #12 using GitHub CLI.
- Write the steps to merge a PR from feature-x into main and close it.
- Show command to add a milestone called v1.0 to your repo (GitHub CLI).
- Simulate a merge conflict by editing the same line in file.txt on two branches, then merge.
- Run the commands to resolve the merge conflict manually and commit.
- Show how to checkout a pull request locally from remote repo.
- Write command to push a tag v2.0 to GitHub.
- Run command to view insights → contributors graph using GitHub CLI.
- Show how to delete a forked repo from GitHub using CLI.
- Run command to change remote URL from HTTPS to SSH.
- Show command to squash commits while merging PR with GitHub CLI.
- Run the commands to sync your fork with the upstream repo.
Advanced Questions
- Create a repo, fork it, clone fork, add remote upstream, and keep fork updated with upstream.
- Write commands to push code to two remotes (origin and backup) simultaneously.
- Simulate: Make 3 local commits, push to GitHub, revert 2nd commit using PR.
- Write commands to fetch only PR #25 from GitHub and test locally.
- Run command to set main branch as default using GitHub CLI.
- Create 2 issues, assign them, link with milestone release-1.0 using CLI.
- Simulate conflict resolution in a pull request and push final merged commit.
- Write script/commands to auto-merge PR if CI passes using GitHub Actions.
- Run commands to enable branch protection rule on main branch using GitHub CLI.
- Show how to clone only the latest commit (shallow clone) from a repo