version_control:git_tips
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
version_control:git_tips [2019/02/17 03:40] – mithat | version_control:git_tips [2024/04/17 22:54] (current) – [.gitignore] mithat | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Git tips ====== | ====== Git tips ====== | ||
- | ===== Tips for Windows users ===== | + | ===== For Windows users ===== |
- | On Windows, use **Git Bash** (in Windows Explorer, right click and //Git Bash Here//) to run git commands. | + | ==== Use Git Bash ==== |
+ | |||
+ | On Windows, use **Git Bash** (in Windows Explorer, right click and //Git Bash Here//) to run Git commands. | ||
+ | |||
+ | A summary of the bash commands you are likely to need (outside of the '' | ||
+ | |||
+ | ==== Creating .gitignore files ==== | ||
If you try to create a '' | If you try to create a '' | ||
If you really, really want to use Windows Explorer, there are reports you can specify '' | If you really, really want to use Windows Explorer, there are reports you can specify '' | ||
- | Note that '' | + | Note that '' |
- | A summary of the bash commands you are likely to need (outside of the '' | ||
===== Initial configuration ===== | ===== Initial configuration ===== | ||
- | The first time you run git, it may get angry with you because you haven' | + | The first time you run Git, it may get angry with you because you haven' |
git config --global user.name "Your Name" | git config --global user.name "Your Name" | ||
git config --global user.email " | git config --global user.email " | ||
Line 21: | Line 27: | ||
The '' | The '' | ||
- | There are more settings you can configure documented [[https:// | + | There are more settings you can configure |
===== .gitignore ===== | ===== .gitignore ===== | ||
+ | The '' | ||
+ | |||
To make Git ignore a specific file: | To make Git ignore a specific file: | ||
<file text .gitignore> | <file text .gitignore> | ||
- | nastyfile.txt | + | my-passwords.txt |
</ | </ | ||
Line 48: | Line 56: | ||
<file text .gitignore> | <file text .gitignore> | ||
# Ignore specific files | # Ignore specific files | ||
- | nastyfile.txt | + | my-passwords.txt |
- | another-nastyfile.docx | + | banking-info.docx |
# Ignore compiled file(s) | # Ignore compiled file(s) | ||
Line 61: | Line 69: | ||
===== Bash tips ===== | ===== Bash tips ===== | ||
- | To change directories in bash:< | + | Git is typically controlled using a command-line interface. On Windows, the preferred interface is provided by Git Bash (see above). Most Linux systems provide Bash-based command-line interfaces by default. In addition, macOS' |
- | ~ is a shortcut | + | So, here is a summary of some Bash commands |
- | Use forward slashes in path specifiers even though paths in Windows are normally specified using backslashes. | + | To change directories:< |
+ | |||
+ | Use forward slashes in path specifiers even though paths in Windows are normally specified using backslashes. | ||
+ | |||
+ | ~ is a shortcut to your home (User) directory. So you could for example: <code bash>cd ~/ | ||
To navigate up one level: <code bash>cd ../</ | To navigate up one level: <code bash>cd ../</ | ||
- | To list all the files (including hidden files) in a directory: <code bash>ls -la</ | + | To list non-hidden files in a directory: <code bash> |
+ | |||
+ | To list **a**ll | ||
+ | |||
+ | The asterisk is a wildcard. So, to list all non-hidden '' | ||
- | To create a new file <code bash> | + | To create a new file in the current directory: |
+ | To create a new directory in the current directory: <code bash> | ||
version_control/git_tips.1550374823.txt.gz · Last modified: 2019/02/17 03:40 by mithat