Git Tips Slides
PageUp x2: previous · PageDown x2: next · Home: index

Creating a PR easily

# Go to the base branch of your PR
git switch main

# Get the latest changes from origin
git pull

# Create a new branch. Give it a better name than "my-branch" :-)
git switch -c my-branch

# Now make your changes

# See what changed
git status

# Commit your work to the **local** Git history.
git commit .

# Push your changes to the central Git repo (origin by default)
# This command will fail:
# fatal: The current branch my-branch has no upstream branch.
git push

# The push should be successful, and your Git hosting provider
# will likely show you a message with a URL to create a PR:
# remote: Create a pull request for 'my-branch' on GitHub by visiting:
# remote:      https://github.com/example/some-repo/pull/new/my-branch