-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7_Undoing-changes
More file actions
36 lines (29 loc) · 1.42 KB
/
7_Undoing-changes
File metadata and controls
36 lines (29 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// this file is for instrucing one on how to do things like
// section 1 //undo commit
// section 2 //revert a commit
// section 3 // revert multiple commits
// section 3 //pull old versions of the file from rep
// section 4 //ammending commits
// section 5 //unstaging files
// section 6 //added section ammending commits
// Undo file delete.. pull a file from the repository use
git checkout -- neededfile // the double dash '--' specifies too checkout that we are not asking for a branch called neededfile
//section 2
// How to revert a commit
git revert 'commit number' // this will automatically reverse a specific commit
//section 3
// how to revert multiple commits
git reset 'commit number' // this moves the head to the specified commit commit defaults to --mixed
-- soft // moves head but does not change the staging directory or working directory
-- mixed // moves the head and reverts the staging dirctory
--hard // moves the head and reverts the staging directory and working directory
//section 4
// how to unstage a file after your have staged it
git reset HEAD filename // tells git to look at the current commit on this branch and changes
//the working directory to match
//Section 5
// how to ammend/edit/change a commit
//this only works on the most recent commit
// you can change the a commit and the description
// make the changes in the working directory then
git commit --amend