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:32] – [Tips for Windows users] mithat | version_control:git_tips [2024/04/17 21:42] – [.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 '' |
+ | |||
+ | |||
===== 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 58: | Line 67: | ||
===== Bash tips ===== | ===== Bash tips ===== | ||
- | To change directories in bash:< | + | To change directories in bash:< |
- | + | ||
- | ~ is a shortcut to your home (User) directory. So you could for example: <code bash>cd ~/ | + | |
Use forward slashes in path specifiers even though paths in Windows are normally specified using backslashes. | 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 ../</ | ||
Line 68: | Line 77: | ||
To list all the files (including hidden files) in a directory: <code bash>ls -la</ | To list all the files (including hidden files) in a directory: <code bash>ls -la</ | ||
- | To create a new file <code bash> | + | To create a new file <code bash> |
version_control/git_tips.txt · Last modified: 2024/04/17 22:54 by mithat