User Tools

Site Tools


version_control:git_basics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
version_control:git_basics [2023/03/01 20:05] – [Basic operations] mithatversion_control:git_basics [2024/04/17 21:53] (current) – [Branching and merging] mithat
Line 25: Line 25:
  
 ===== Branching and merging ===== ===== Branching and merging =====
-  * A git repository has a default branch called **master**.+  * A git repository has a default branch called **main**. (In older configurations this may be **master**.)
   * To create a new branch: <code bash>git branch branch-name</code>   * To create a new branch: <code bash>git branch branch-name</code>
   * Switch to an existing branch: <code bash>git checkout branch-name</code>   * Switch to an existing branch: <code bash>git checkout branch-name</code>
Line 31: Line 31:
   * Merge changes in another branch into the current branch: <code bash>git merge branch-name</code>   * Merge changes in another branch into the current branch: <code bash>git merge branch-name</code>
   * Delete a branch that you're not currently in: <code bash>git branch -d branch-name</code>   * Delete a branch that you're not currently in: <code bash>git branch -d branch-name</code>
 +
 +<WRAP center round tip 90%>
 +The new ''[[https://git-scm.com/docs/git-switch|git switch]]'' command is an alternative to some ''git branch'' operations. However, as of this writing, it is still experimental.
 +</WRAP>
  
 ===== Ignoring files ===== ===== Ignoring files =====
   * To make git ignore some files in your project, create a ''.gitignore'' file in the project directory.<file text .gitignore>   * To make git ignore some files in your project, create a ''.gitignore'' file in the project directory.<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)
version_control/git_basics.1677701127.txt.gz · Last modified: 2023/03/01 20:05 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki