--- title: "Git 102" slug: "git-102-basic-git-commands" description: "Basic Git commands and an overview of merge conflicts. View it all here." updated: 2024-10-08T03:59:10Z published: 2024-10-08T03:59:10Z canonical: "learn.allspice.io/git-102-basic-git-commands" --- > ## Documentation Index > Fetch the complete documentation index at: https://learn.allspice.io/llms.txt > Use this file to discover all available pages before exploring further. # Git 102 - Basic Git commands ## Git 102: Basic Git commands We have a [Git cheat sheet](/v1/docs/git-cheat-sheet) with more commands. Copy entire remote repo to current directory ``` git clone [url] ``` Fetch and merge any commits from the tracking remote branch ``` git pull ``` Transfer your local branch commits to the remote branch repo ``` git push [alias] [branch] ``` Switch to another branch and check it out to your current working directory ``` git switch ``` Show modified files in your working directory. These files are staged for your next commit ``` git status ``` Add a file as-is to your next commit, aka stage the file ``` git add [file/directory] ``` Commit your staged files as a new commit ``` git commit -m "[descriptive message]" ``` ### Writing a good commit message - Short (Under 60 characters) - Descriptive (what did you do?) - This will be part of the review - Use imererative tense - Add bypass cap - vs "Added bypass cap" ## Git 102: Merge conflicts Merge conflicts happen when two different people make changes to files on either the same branch, or different branches. When they go to merge, there will be a merge conflict. ### Avoiding merge conflicts The best way to deal with merge conflicts is by prevention. - Set up branch protection on main - Separate schematics into multiple files - Communicate when working on single files like the PCB - Use LFS to lock files ### Fixing merge conflicts Although we're building a merge engine, for now, the best way to fix a merge conflict is to view the file changes in AllSpice and manually copy the changes to the new file. ## Quick links and resources - [Todo before your onboarding](hhttps://learn.allspice.io/docs/todo-before-you-start-allspiceio) - [learn.allspice.io](https://learn.allspice.io) - [AllSpice Crash Course](/v1/docs/allspice-crash-course) - AllSpice Support contact: Daniel Lindmark - support@allspice.io or daniel@allspice.io - Selected AllSpice Blogs: - [Design Reviews](https://allspice.io/post/design-review-basics-in-git-for-hardware) - [Git for Hardware revision control](https://allspice.io/post/revision-control-concepts-git-for-hardware) - [Pushing & Branching](https://allspice.io/post/pushing-branching-in-git-for-hardware) ## Teams and role-based permissions Visit our [main article on teams](/v1/docs/how-to-configure-teams)