version_control:git_basics
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
version_control:git_basics [2020/09/25 22:51] – [Ignoring files] mithat | version_control:git_basics [2024/04/17 21:53] (current) – [Branching and merging] mithat | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== Clarification ===== | ===== Clarification ===== | ||
- | | + | <WRAP center round tip b60%> |
+ | **Git** ≠ **GitHub** | ||
+ | </ | ||
+ | |||
+ | There are many Git repository hosting services, and [[https://github.com/|GitHub]] wasn't even the first. Some popular alternatives are [[https://gitlab.com/|GitLab]] and [[https:// | ||
===== Basic operations ===== | ===== Basic operations ===== | ||
Line 17: | Line 21: | ||
<WRAP center round tip 90%> | <WRAP center round tip 90%> | ||
- | Use the '' | + | Use the '' |
</ | </ | ||
===== Branching and merging ===== | ===== Branching and merging ===== | ||
- | * A git repository has a default branch called **master**. | + | * A git repository has a default branch called |
* To create a new branch: <code bash>git branch branch-name</ | * To create a new branch: <code bash>git branch branch-name</ | ||
* Switch to an existing branch: <code bash>git checkout branch-name</ | * Switch to an existing branch: <code bash>git checkout branch-name</ | ||
Line 27: | Line 31: | ||
* Merge changes in another branch into the current branch: <code bash>git merge branch-name</ | * Merge changes in another branch into the current branch: <code bash>git merge branch-name</ | ||
* Delete a branch that you're not currently in: <code bash>git branch -d branch-name</ | * Delete a branch that you're not currently in: <code bash>git branch -d branch-name</ | ||
+ | |||
+ | <WRAP center round tip 90%> | ||
+ | The new '' | ||
+ | </ | ||
===== Ignoring files ===== | ===== Ignoring files ===== | ||
* To make git ignore some files in your project, create a '' | * To make git ignore some files in your project, create a '' | ||
# 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 43: | Line 51: | ||
<WRAP center round tip 80%> | <WRAP center round tip 80%> | ||
- | The file name must be '' | + | The file name must be '' |
- | < | + | < |
touch .gitignore | touch .gitignore | ||
</ | </ |
version_control/git_basics.1601074305.txt.gz · Last modified: 2020/09/25 22:51 by mithat