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:04] – [Clarification] mithatversion_control:git_basics [2024/04/17 21:53] (current) – [Branching and merging] mithat
Line 21: Line 21:
  
 <WRAP center round tip 90%> <WRAP center round tip 90%>
-Use the ''git rm'' and ''git mv'' commands to delete and move/rename files instead of the Windows Explorer, the Finder in macOS, your Linux file manager, or other shell commands. Doing so will simplify staging.+Use the ''git rm'' and ''git mv'' commands to delete and move/rename files instead of the standard tools in your operating system. Doing so will simplify staging.
 </WRAP> </WRAP>
  
 ===== 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.1677701052.txt.gz · Last modified: 2023/03/01 20:04 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki