Version Control System (VCS) is a software tool that helps track and manage changes to files and code over time
VCS provides a systematic way to keep track of different versions of files, collaborate with others, and maintain a history of changes made to a project
Key features of a VCS include:
Version Tracking: keeps track of changes made to files over time, allowing you to see the history of modifications, who made them, and when they were made
Collaboration: Multiple developers can work on the same project simultaneously, with changes tracked, merged, and managed to avoid conflicts
Branching and Merging: Developers can create separate branches of the codebase to work on specific features or fixes, later merging them back into the main codebase
Revert to Previous Versions: Easily revert back to a previous version of the code if needed
Conflict Resolution: Tools provided to help resolve conflicts and merge changes
Historical Documentation: Maintains a chronological record of changes, useful for auditing, troubleshooting, and understanding project evolution
Backup and Disaster Recovery: Acts as a form of backup by storing all versions of files
GitHub is a web-based platform that provides version control and collaboration tools for software development projects
GitHub started in 2008 as a version control system and evolved into a social utility for programmers
Terminology:
Repository (Repo): Storage space where project files, code, and version history are stored
Commit: A snapshot of changes made to the files in a repository
Branch: A separate line of development within a repository
Pull Request (PR): A request to merge changes from one branch into another
Merge: Combining changes from one branch into another
Terminology:
Fork: Creating a personal copy of someone else's repository
Clone: Creating a local copy of a repository on your computer
Push: Uploading local changes to the remote repository on GitHub
Pull: Retrieving changes from a remote repository and merging them into your local repository
Issue: Tracking tasks, enhancements, bugs, or other discussions related to a repository
Terminology:
Label: Categorizes and organizes issues and pull requests
Milestone: Groups and tracks a set of related issues or pull requests
Collaborator: Someone with access to a repository who can contribute to it
README: A file providing important information about the repository
Gist: A simple way to share code snippets or small snippets of text
.gitignore is a file that tells Git which files or folders to ignore in a project
Entries in .gitignore can follow a matching pattern:
* is a wildcard match
/ is used to ignore pathnames relative to the .gitignore file
# is used to add comments to a .gitignore file
Example of a .gitignore file:
Ignore Mac system files .DS_store
Ignore node_modules folder node_modules
Ignore all text files *.txt
Ignore files related to API keys .env
Ignore SASS config files .sass-cache
README file is a text file that introduces and explains a project, containing essential information about the project
Command Line Interface (CLI) is a program that uses text-based commands to interact with the computer’s operating systems
CLI allows users to navigate through files and folders in the computer, similar to Windows Explorer on Windows or Finder on Mac OS
CLI interactions are often faster for experienced users who are comfortable with keyboard input and can quickly execute commands
CLI applications consume fewer system resources compared to GUI applications
CLI can be accessed remotely over networks, providing remote access and automation capabilities
CLI commands allow users to specify exact parameters and options for commands, enabling precise control and flexibility
CLI allows users to write scripts that can perform series of tasks automatically and sequentially
CLI can be more intuitive and familiar to those who are comfortable with text-based interfaces and have experience in programming and scripting
CLI provides direct access to system functions and avoids the resource-intensive nature of GUIs, making it ideal for server management and administration
CLI often provides detailed information and logs that aid in troubleshooting and diagnosing issues within systems and networks
CLI applications typically have a smaller attack surface compared to GUI applications, potentially reducing the risk of vulnerabilities
CLI is more responsive and consumes less data when working with remote servers or devices over slow or limited bandwidth
Common CLI programs include Bash, Windows Terminal, PowerShell, Terminal (macOS), Windows Subsystem for Linux (WSL), Cygwin, Zsh (Z Shell), Fish (Friendly Interactive Shell), and Tcsh (Tenex C Shell)
Basic CLI commands for navigating directories:
cd: navigate directories
dir (or ls on macOS): list contents of the current directory
To create a newdirectory, use the mkdir command followed by the directory name
To create a newempty text file, use the echocommand and output the content to a file
To copy or move files to another location, use the copy or move command followed by the source and destination paths
To rename or deletefiles, use the rename or del command followed by the filename
To delete an empty directory, use the rmdir command followed by the directory name
To view the content of a text file, use the type command followed by the filename
To edit a file, use the edit command followed by the filename or use external text editors like Notepad
To filter and transform text within a file, use commands like find, findstr, grep, sed, and awk
To combine files, use the copy command with the /b parameter or findstr command with the /n parameter
Basic Commands in Command Line Interface (CLI):
Navigatingdirectories:
cd: changedirectory
dir (or ls on macOS): list contents of the current directory
To viewcurrentdirectory: $ cd
To listcontents of the currentdirectory: $ dir
To navigate to a differentdirectory: use the ‘cd’ command followed by the directorypath
To move up onelevel in the directorystructure: $ cd..
To navigate to a specifieddirectorypath: $ cdC:\Windows\System32
To handle spaces in directorynames: enclose the path in doublequotes, e.g., $ cd "C:\ProgramFiles"
Use TAB key for auto-completion of directory and file names
Creating, moving, copying, and deleting files and directories:
To create a newdirectory: use mkdir command followed by the directoryname, e.g., $mkdirMyFolder
To create a newemptytextfile: use echo command and output the content to a file, e.g., $echo.>MyFile.txt
To copyafiletoanotherlocation: use copy command followed by the source and destination paths, e.g., $copyMyFile.txtC:\Temp\
To move a file to anotherlocation: use move command, e.g., $ moveMyFile.txtC:\Temp\
To rename a file: use rename command followed by the current and newfilename, e.g., $ renameMyFile.txtNewFile.txt
Todeleteafile: use delcommand followed by the filename, e.g., $delNewFile.txt
To delete an emptydirectory: use rmdir command followed by the directoryname, e.g., $rmdirMyFolder
File content operations:
Viewing file content:
To view the content of a text file: use type command followed by the filename, e.g., $ type MyFile.txt
To view specific lines from the beginning of a file: use type command with the /p parameter, e.g., $ type MyFile.txt | more
Editing files:
To open a file for editing using Windows basic text editor: use edit command followed by the filename, e.g., $ edit MyFile.txt
To open a file for editing using Notepad: use start command followed by the filename, e.g., $ start notepad MyFile.txt
Working with text:
Filtering and transforming text:
Commands like find, findstr, grep, sed, and awk can be used
Example using findstr: $ findstr "searchword" MyFile.txt
Combining files:
To combine files: use copy command with the /b parameter, e.g., $ copy /b File1.txt + File2.txt CombinedFile.txt
To combine files with line numbers: use findstr command with the /n parameter, e.g., $ findstr /n "^" File1.txt File2.txt > CombinedFileWithNumbers.txt