Mastering GIT Basics for Efficient Version Control

getting started with git n.w
1 / 30
Embed
Share

Learn essential GIT commands - from basic navigation and project creation to viewing commit logs and accessing remote repositories on GitHub. Get hands-on experience with practical examples and improve your version control skills swiftly.

  • GIT Basics
  • Version Control
  • GitHub Access
  • Commit Logs
  • Efficient Workflow

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Getting Started with GIT

  2. Basic Navigation cd means change directory cd .. moves you up a level cd dir_name moves you to the folder named dir_name A dot (.) refers to the current directory ls displays directory contents

  3. Create a Project from Scratch git init project creates a project directory git add adds files to the directory git commit m"message" commits the changes $ cd projects $ git init project1 Create a projects directory on ned in 216 *** create file1.txt *** $ cd project1 $ git add file1.txt $ git commit -m "Committing project 1"

  4. Create a Project from an Existing Directory git init . initializes the current directory git add * adds all files in the directory git commit m"message" commits the changes Create a projects/project2 directory, and create a file in that directory called file2.txt $ cd ../projects/project2 $ git init . $ git add * $ git commit -m "Committing project 2"

  5. View your Commit Logs git log displays your log history

  6. Check your Status git status displays the status of the repo In the projects/project2 directory, modify file2.txt and create a file called file3.txt modified file new file

  7. Update your repo add the file commit the changes check the status

  8. Try It Navigate to the projects directory Initialize project3 Create file4.txt in the directory Add file4 to the repo View Git status Commit the change Modify file4 View Git status Commit the change Create file5.txt in project3 View Git status Add it to the repo Commit the change

  9. Access a Git Project from GitHub Most open source projects have a read-only Git URL Visit github.com Explore git clone https://... copies repository content to your system

  10. Access a Git project Right click here to Edit Paste, or press the Insert key on the keyboard Create a new folder from the command line Change to the new folder Pull down a copy of a github project Display directory contents URL -- https://github.com/garrick/git-for-one-presentation.git

  11. Keep Current git pull will bring down latest content If you've made conflicting changes, this may not work easily You can always delete the directory contents and pull down a fresh copy

  12. Sharing on GitHub Create a GitHub account

  13. Pick a Plan With a free account, all repos are public.

  14. Create a Repository on GitHub

  15. Set up the Repository

  16. Set up your GitHub "origin" Copy the URL from GitHub In Bash: $git remote add origin https://... Paste URL You can paste by right clicking

  17. Push to GitHub $git push -u origin master Copies your project to GitHub Enter your credentials You should only have to do this once! "Origin" is GitHub "Master" is local copy

  18. Voila!

  19. Add a ReadMe

  20. Pull the ReadMe into your Local copy Copy URL from GitHub In Bash: $ git pull URL

  21. Try It Create a GitHub repo for Project1 Push your local copy to the repo Add a ReadMe file in GitHub Pull the ReadMe to your local copy Modify file1.txt in Project1 Add a new file to Project1 Commit your changes (don't forget to add the new file to the repo first!) Push your changes to GitHub

  22. Deleting a Repo from GitHub Select the Repository Click Settings Click "Delete this repository "under Danger Zone This cannot be undone! Type the name of the repository to confirm

  23. Git for Windows Download Git Install Git Use default options

  24. Open Git Bash

  25. Configure Git Configure username Configure password $ git config --global user.name "Joe Shmo" $ git config --global user.email "jshmo@highline.edu" Everything else is just the same! This creates two key-value pairs, used for tracking commits.

  26. Store your Credentials Download Windows Credential Store for Git Run It! Click Yes

  27. Summary Initialize a project git init projectName git init . Add a file git add fileName git add * Commit changes git commit -m "remark" View the log git log Check status git status Add a remote location to upload files git remote add origin url Push changes from local to remote git push -u origin master Pull changes from remote to local git pull url

  28. Git Isn't Just for Code You can commit anything to a Git repository Pictures Word docs PowerPoint presentations Videos Music etc.

  29. Learn More GitGuys Git Documentation Git Cheat Sheet

More Related Content