Download presentation
Presentation is loading. Please wait.
Published byAlfred Payne Modified over 8 years ago
1
Carl’s Ultra-Basic Guide to the Command Line and Git Carl G. Stahmer Director of Digital Scholarship www.carlstahmer.com cstahmer UD Davis Data Science Initiative 4/8/2016
2
https://git-scm.com/downloads
3
Folders You Know and Love HD | C:// Folder 1 Folder 2 Folder 3 Folder 4 Folder A Folder B Folder C
4
Folders You Know and Love HD | C:// Folder 1 Folder 2 Folder 3 Folder 4 Folder A Folder B Folder C C://Folder 1/Folder A
5
Folders You Know and Love HD | C:// Folder 1 Folder 2 Folder 3 Folder 4 Folder A Folder B Folder C C://Folder 4/Folder C
6
Unix Directory Structure / (Root Directory) Directory_1 Directory_2 Directory_3 Directory_4 Directory_A Directory_B Directory_C
7
/Directory_1/Directory_A/ (Root Directory) Directory_1 Directory_2 Directory_3 Directory_4 Directory_A Directory_B Directory_C Unix Directory Structure
8
/Directory_1/Directory_A/ (Root Directory) Directory_1 Directory_2 Directory_3 Directory_4 Directory_A Directory_B Directory_C Unix Directory Structure
9
Why Directory?
10
usage: ls
11
usage: ls -a
12
Usage: ls –l
13
Essential Unix Commands CommandExampleDescription ls La –a List files in a directory cd cd /root/dir cd../ Change directory cpcp file1 file2Copy file1 as file2 mvmv file1 /file2 Move file one to root and name file2 rmrm file1Delete file1 mkdirmdkir photos Made a new directory named photos rmdirrmdir photos Remove photos directory moremore file1Read file1 manman lsShow manual for ls
14
Useful Unix Commands CommandExampleDescription grepgrep ”string” fileSearch files chmodchmod 777 file1 Change permissions killKill -9 192312Kill process ID pushdpushd./photos Move into photos directory popd Pop back up from pushd diffdiff file1 file2 Compare two files pwd Show current directory history Prints your terminal history
15
Fun Unix Commands CommandExampleDescription who Tell you who you are finger Tells you who’s on network Traverse back through previous command stack Traverse back down through command stack date Show date fortune Random humorous message rev Reverses any string Z Stops a process
16
All text files (and editors) are not made equal What you see
17
All text files (and editors) are not made equal What you see
18
VI/VIM Text Editor
19
Open Source GUI Text Editors Mac: Text Wrangler from Bare Bones Software http://www.barebones.com/ http://www.barebones.com/ Windows: NotePad++ https://notepad-plus-plus.org/https://notepad-plus-plus.org/ Every good coder needs a good text editor. Download one of the following based on your platform:
20
Open Source Distributed Version Control
21
Multiple Git Repositories
22
https://git-scm.com/downloads
23
What is Open Source Version Control?
25
What is Open Source Distributed Version Control? User 1 User 2 User 3 Central Repository Central Repository Push Pull
26
Change History
27
Conflict Resolution
28
Most Important: Revert Version 1Version 2Version 3Version 2
29
Beginning to Git CommandExampleDescription git init cd /directory/to/control git init Puts the working directory under Git control git status Returns status information about the repository git branch Tell you on which branch you are currently working git addgit add filename Adds the specified file to the staging area git commit –m Commits the staged files
30
Branching and Merging CommandExampleDescription git checkout -bgit checkout –b newbranch Creates a new branch and checks it out git checkoutgit checkout master Checks out the named branch git addgit add filename Adds a file to the Staging Area git commit –m Commits staged files with entered comments git commit Commits the staged files and prompts for comments
31
Step 1: Create directory for new repository Step 2: CD into new directory Step 4: Add some files to the directory Step 3: Check repository status Creating a Local Repository
32
Step 1: Check status to see what’s changed Step 2: Add changed files to Staging Area Step 4: Commit changes Step 3: Check status to see changes Committing Changes to Repository Step 5: View Log
33
Step 2: Create new branch Step 4: Switch between branches Step 3: See new branch Branching Step 1: See branches
34
Step 2: Checkout branch you want to merge into Step 3: Merge branch Merging Step 1: Commit changes to working branch
35
Reverting Version 1Version 2Version 3Version 2 Step 1: Identify Version
36
Reverting Version 1Version 2Version 3Version 2 Step 2: View files from a commit to verify version Step 3: Get back current commit Step 4: Reset staging and history
37
Reverting Version 1Version 2Version 3Version 2 Step 4: Checkout the file version you want Step 5: Add the file to the Staging Area Step 6: Commit
38
Working with Remote Repositories
39
Working with Remotes CommandExampleDescription git checkout -bgit checkout –b newbranch Creates a new branch and checks it out git checkoutgit checkout master Checks out the named branch git addgit add filename Adds a file to the Staging Area git commit –m Commits staged files with entered comments git commit Commits the staged files and prompts for comments
40
Fetch Remote Step 1: Create directory for new repository Step 2: CD into new directory Step 3: Add origin repository Step 4: Fetch remote repository metadata
41
Fetch Remote Simple Step 1: Clone remote repository
42
Thank You Carl G. Stahmer Director of Digital Scholarship www.carlstahmer.com cstahmer Ultra-Basic Guide to the Command Line and Git 4/8/2016
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.