Useful git
hints
Editor
Mac OS and Linux
In your ~/.bash_profile
(if you use BASH) or ~/.zshrc
(if you use ZSH), you can setup an editor of choice to save you from having to use -m "my message"
when committing and to ease the creation of multiline commits messages.
For BASH:
#!/usr/bin/env bash
export EDITOR=/usr/bin/nano
For ZSH:
#!/usr/bin/env zsh
export EDITOR=/usr/bin/nano
After running a new terminal (or source ~/.bash_profile
in existing terminals), issuing git commit
will open your text editor of choice (nano
in this case).
After typing your commit message, exiting and saving will create the commit.
Commits network
git log --all --decorate --oneline --graph
can be particularly useful to see network of commits across the branches.
To facilitate this you can add an alias in .bashrc
(linux) or .bash_profile
(mac):
alias gitgraph='git log --all --decorate --oneline --graph'
Navigating to https://github.com/nestauk/YOUR_REPO/network you can see a graphical representation of the commits graph:
Appendix
Network example, terminal
Note that in this representation we see all the branches referencing a commit, including eventually those already merged.
$ git log --all --decorate --oneline --graph
* 2f19a1f (HEAD -> 41_workflow_doc, origin/41_workflow_doc) formattting
* 4e45a8c formatting
* 7b19884 add note about draft pull requests
* 25fcd41 rename it on the markdown too, stupid!
* eaeb377 image file rename
* 1869f0b Improve the workflow documentation
| * d06a93f (origin/14_graph, 14_graph) Unified graph (closes #14)
| * cfeb79a (origin/13_schema_current, 13_schema_current) Document the schema of data sources used in current projects (closes #13)
| * 8be4e67 (origin/11_data_sources, 11_data_sources) better meta documentation taking in account (dataset name and doc page)
| * a263c7c add arxlive's arxiv endpoint
| * b7fe0fe add EURITO endpoints
| * e7b8f1d Document data sources used in current projects
|/
* ac004a3 (origin/dev, origin/22_schema_doc, dev) How to document schemas
| * f3f0a00 (refs/stash) WIP on 22_schema_doc: bdd1544 f
| |\
| | * 121be8b index on 22_schema_doc: bdd1544 f
| |/
| * bdd1544 f
| * 88ebfc1 mention to link the schema
| * efe2f23 expanded on the date format
| * 0f83724 link MAG's example
| * 22e4613 tweak
| * 707ac10 formatting
| * 71e4e35 implement review changes and added an example
| * eb98df7 How to document schemas (closes #22)
|/