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/02/28 23:55] – [Clarification] mithatversion_control:git_basics [2024/04/17 21:53] (current) – [Branching and merging] mithat
Line 6: Line 6:
 </WRAP> </WRAP>
  
-There are many Git repository hosting services, and [[https://github.com/|GitHub]] wasn't even the first. Some popular alternatives include [[https://gitlab.com/|GitLab]] and [[https://bitbucket.org|Bitbucket]]. But there are many others. Git was developed to support the development of the Linux operating system apart from any particular company.+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://bitbucket.org|Bitbucket]]. But there are many others. Also, Git is not the only VCS in use today. It was originally created independently of any company to support the development of the Linux operating system. It was later adopted by a number of developers of open-source software for their projects before eventually becoming the de-facto standard VCS it is today for both open-source and proprietary projects.
  
 ===== Basic operations ===== ===== Basic operations =====
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.1677628559.txt.gz · Last modified: 2023/02/28 23:55 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki