Skip to content

Instantly share code, notes, and snippets.

@roberthoenig
Last active November 14, 2017 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roberthoenig/0d784c47a23858a57478293bb8e41a71 to your computer and use it in GitHub Desktop.
Save roberthoenig/0d784c47a23858a57478293bb8e41a71 to your computer and use it in GitHub Desktop.
Some copy-paste git commands for the Zulip git workflow.

These are messages you can directly use for responding to many common git questions.

Updating master

Enter the following commands one by one into your command line:
```.sh
git checkout master
git fetch upstream
git rebase upstream/master
```
---
1. Switch to your local master branch.
2. Download all new commits from the Zulip repository.
3. Add the new commits on top of your local master branch.
```

Rebasing a branch

Enter the following commands one by one into your command line:
```.sh
git checkout 
git fetch upstream
git rebase upstream/master
```
---
1. Switch to the branch  you want to update.
2. Download all new commits from the Zulip repository.
3. Add the new commits on top of your local master branch.

Editing the last commit

Enter the following commands one by one into your command line:
```.sh
git add -u
git commit --amend
```
---
1. Stage all files you edited.
2. Add the changes in the staged files to your last commit.
*3. In text editor: Edit the commit message (if you want) and save.*
@roberthoenig
Copy link
Author

There is also git pull --rebase as a shortcut to git fetch; git rebase, but I think it is important for understanding to use the verbose versions in the beginning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment