mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
- Updated 260+ links from ".html" to ".md" to reduce the number of issues reported about hyperlinks not working when viewing docs on Github. - Removed temporary workaround that suppressed all warnings reported by sphinx build for every link ending in ".html". Details: The recent upgrade to recommonmark==0.5.0 supports auto-converting ".md" links to ".html" so that the resulting HTML output is correct. Notice that links pointing to a heading i.e. "../filename.html#heading", were not updated because recommonmark does not auto-convert them. These links do not generate build warnings and do not cause any issues. However, there are about ~100 such links that might still get misreported as broken links. This will be a follow-up issue. Background: docs: pip upgrade recommonmark and CommonMark #13013 docs: Allow .md links between doc pages #11719 Fixes #11087.
4.3 KiB
4.3 KiB
Git Cheat Sheet
See also fixing commits
Common Commands
- add
git add foo.py
- checkout
git checkout -b new-branch-namegit checkout mastergit checkout old-branch-name
- commit
git commit -m "topic: Commit message title."git commit --amend: Modify the previous commit.
- config
git config --global core.editor nanogit config --global core.symlinks true
- diff
git diffgit diff --cachedgit diff HEAD~2..
- fetch
git fetch origingit fetch upstream
- grep
git grep update_unread_counts
- log
git log
- pull
git pull --rebase: Use this. Zulip uses a rebase oriented workflow.git pull(with no options): Will either create a merge commit (which you don't want) or do the same thing asgit pull --rebase, depending on whether you've configured Git properly
- push
git push origin +branch-name
- rebase
git rebase -i HEAD~3git rebase -i mastergit rebase upstream/master
- reflog
git reflog | head -10
- remote
git remote -v
- reset
git reset HEAD~2
- rm
git rm oops.txt
- show
git show HEADgit show HEAD~~~git show master
- status
git status
Detailed Cheat Sheet
- add
git add foo.py: addfoo.pyto the staging areagit add foo.py bar.py: addfoo.pyANDbar.pyto the staging areagit add -u: Adds all tracked files to the staging area.
- checkout
git checkout -b new-branch-name: create branchnew-branch-nameand switch/checkout to that new branchgit checkout master: switch to yourmasterbranchgit checkout old-branch-name: switch to an existing branchold-branch-name
- commit
git commit -m "commit message": It is recommended to type a multiline commit message, however.git commit: Opens your default text editor to write a commit message.git commit --amend: changing the last commit message. Read more here
- config
git config --global core.editor nano: set core editor tonano(you can set this tovimor others)git config --global core.symlinks true: allow symbolic links
- diff
git diff: display the changes you have made to all filesgit diff --cached: display the changes you have made to staged filesgit diff HEAD~2..: display the 2 most recent changes you have made to files
- fetch
git fetch origin: fetch origin repositorygit fetch upstream: fetch upstream repository
- grep
git grep update_unread_counts static/js: Search our JS for references to update_unread_counts.
- log
git log: show commit logsgit log --oneline | head: To quickly see the latest ten commits on a branch.
- pull
git pull --rebase: rebase your changes on top of master.git pull(with no options): Will either create a merge commit (which you don't want) or do the same thing asgit pull --rebase, depending on whether you've configured Git properly
- push
git push origin branch-name: push you commits to the origin repository only if there are no conflicts. Use this when collaborating with others to prevent overwriting their work.git push origin +branch-name: force push your commits to your origin repository.
- rebase
git rebase -i HEAD~3: interactive rebasing current branch with first three items on HEADgit rebase -i master: interactive rebasing current branch with master branchgit rebase upstream/master: rebasing current branch with master branch from upstream repository
- reflog
git reflog | head -10: manage reference logs for the past 10 commits
- remote
git remote -v: display your origin and upstream repositories
- reset
git reset HEAD~2: reset two most recent commits
- rm
git rm oops.txt: removeoops.txt
- show
git show HEAD: display most recent commitgit show HEAD~~~: display third most recent commitgit show master: display most recent commit onmaster
- status
git status: show the working tree status, unstaged and staged files