Git & GitHub– Assignment– 3

Basic Questions

  1. Create a new repository on GitHub named myrepo and copy the remote URL.
  2. Run the command to add a remote origin to an existing local repo.
  3. Show command to verify which remotes are linked with your repository.
  4. Push the main branch to GitHub for the first time.
  5. Show the command to push a new local branch called feature1 to remote.
  6. Clone a repository from https://github.com/test/project.git into your machine.
  7. Show the command to clone a repo into a specific folder project-folder.
  8. Pull the latest changes from the remote main branch.
  9. Show the command to fetch changes from all remote branches.
  10. Run command to view all remote-tracking branches in your local repo.
  11. Show how to rename a remote from origin to upstream.
  12. Run command to remove a remote named testremote.
  13. Show the git command to list all starred repositories of your account (GitHub CLI).
  14. Fork a repository from GitHub UI and then clone it into your system (write command for clone).
  15. Show how to push commits from local dev branch to remote dev.
  16. Write command to set upstream for a branch feature-login.
  17. Show command to check if your local branch is ahead/behind remote.
  18. Push only a single commit with commit hash abc123 to GitHub.
  19. Run command to delete a remote branch bugfix-1.
  20. Show command to check remote repository URL of origin.

Intermediate Questions

  1. Create a new repo locally, connect it to GitHub, push code, and confirm with a command.
  2. Run command sequence to fork a repo → clone it → push new branch → open PR.
  3. Show how to create a pull request from feature-2 to main branch (GitHub CLI).
  4. Fetch updates from remote but don’t merge, then show the difference with your local branch.
  5. Write command sequence to resolve remote-tracking conflict using rebase.
  6. Run command to fetch only branch develop from a remote repo.
  7. Show command to list open pull requests using GitHub CLI.
  8. Create a label called urgent in GitHub repository using CLI.
  9. Run command to assign yourself to issue #12 using GitHub CLI.
  10. Write the steps to merge a PR from feature-x into main and close it.
  11. Show command to add a milestone called v1.0 to your repo (GitHub CLI).
  12. Simulate a merge conflict by editing the same line in file.txt on two branches, then merge.
  13. Run the commands to resolve the merge conflict manually and commit.
  14. Show how to checkout a pull request locally from remote repo.
  15. Write command to push a tag v2.0 to GitHub.
  16. Run command to view insights → contributors graph using GitHub CLI.
  17. Show how to delete a forked repo from GitHub using CLI.
  18. Run command to change remote URL from HTTPS to SSH.
  19. Show command to squash commits while merging PR with GitHub CLI.
  20. Run the commands to sync your fork with the upstream repo.

Advanced Questions

  1. Create a repo, fork it, clone fork, add remote upstream, and keep fork updated with upstream.
  2. Write commands to push code to two remotes (origin and backup) simultaneously.
  3. Simulate: Make 3 local commits, push to GitHub, revert 2nd commit using PR.
  4. Write commands to fetch only PR #25 from GitHub and test locally.
  5. Run command to set main branch as default using GitHub CLI.
  6. Create 2 issues, assign them, link with milestone release-1.0 using CLI.
  7. Simulate conflict resolution in a pull request and push final merged commit.
  8. Write script/commands to auto-merge PR if CI passes using GitHub Actions.
  9. Run commands to enable branch protection rule on main branch using GitHub CLI.
  10. Show how to clone only the latest commit (shallow clone) from a repo