version_control:git_tips
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
version_control:git_tips [2019/02/17 03:30] – [Bash tips] mithat | version_control:git_tips [2024/04/17 22:39] – [Creating .gitignore files] 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 are 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 '' | ||
===== 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 " | ||
</ | </ | ||
- | The '' | + | The '' |
- | There are more settings you can configure documented [[https:// | + | There are more settings you can configure |
===== .gitignore ===== | ===== .gitignore ===== | ||
- | 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 |
</ | </ | ||
- | To make git ignore all files with a '' | + | To make Git ignore all files with a '' |
<file text .gitignore> | <file text .gitignore> | ||
*.exe | *.exe | ||
</ | </ | ||
- | To make git ignore all files in a directory called foo: | + | To make Git ignore all files in a directory called foo: |
<file text .gitignore> | <file text .gitignore> | ||
foo/* | foo/* | ||
Line 45: | Line 54: | ||
<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 58: | Line 67: | ||
===== 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.txt · Last modified: 2024/04/17 22:54 by mithat