-
Notifications
You must be signed in to change notification settings - Fork 3
/
wrong-files-added-in-commit.html
199 lines (148 loc) · 5.48 KB
/
wrong-files-added-in-commit.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<html lang="en">
<head>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-112480279-1');
</script>
<meta charset="utf-8">
<title>channelCS - Wrong files added in commit</title>
<meta name="description" content="">
<meta name="author" content="channelCS">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="/theme/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="/theme/bootstrap.min.css" rel="stylesheet">
<link href="/theme/bootstrap.min.responsive.css" rel="stylesheet">
<link href="/theme/local.css" rel="stylesheet">
<link href="/theme/pygments.css" rel="stylesheet">
<!-- So Firefox can bookmark->"abo this site" -->
<link href="/feeds/all.atom.xml" rel="alternate" title="channelCS" type="application/atom+xml">
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="">channelCS</a>
<div class="nav-collapse">
<ul class="nav">
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="content">
<div class="row">
<div class="span9">
<div class='article'>
<div class="content-title">
<h1>Wrong files added in commit</h1>
Mon 19 March 2018
by <a class="url fn" href="/author/aditya-arora.html">Aditya Arora</a>
</div>
<div><p>This post helps users to revert changes made while using git. We might add wrong files while committing. It is a good practice to use </p>
<div class="highlight"><pre><span></span>git status
</pre></div>
<p>to check what files are currently worked on.
So this is what you have done</p>
<ul>
<li>Added the wrong files to the staging area</li>
<li>Commited</li>
<li>Not push</li>
</ul>
<p><strong>What to do now?</strong></p>
<ul>
<li>Reset to the last commit</li>
</ul>
<div class="highlight"><pre><span></span>git reset --soft HEAD~1
</pre></div>
<ul>
<li>Remove folders that you dont want</li>
</ul>
<div class="highlight"><pre><span></span>git reset node_modules/
</pre></div>
<ul>
<li>Check status to see the added files in the staging area</li>
</ul>
<div class="highlight"><pre><span></span>git status
</pre></div>
<ul>
<li>Make new commits</li>
</ul>
<div class="highlight"><pre><span></span>git commit -m "Cleaning styles.css"
</pre></div>
<ul>
<li>Push the commits</li>
</ul>
<div class="highlight"><pre><span></span>git push -u origin master
</pre></div></div>
<hr>
<h2>Comments</h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'channelcsgit';
var disqus_title = 'Wrong files added in commit';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
<div class="span3">
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Site
</li>
<li><a href="/archives.html">Archives</a>
<li><a href="/tags.html">Tags</a>
<li><a href="/feeds/all.atom.xml" rel="alternate">Atom feed</a></li>
</ul>
</div>
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Categories
</li>
<li><a href="/category/audio-processing.html">Audio Processing</a></li>
<li><a href="/category/deep-learning.html">Deep Learning</a></li>
<li><a href="/category/docs.html">Docs</a></li>
<li><a href="/category/github.html">Github</a></li>
<li><a href="/category/main.html">main</a></li>
<li><a href="/category/outreachy.html">Outreachy</a></li>
</ul>
</div>
<div class="well" style="padding: 8px 0; background-color: #FBFBFB;">
<ul class="nav nav-list">
<li class="nav-header">
Links
</li>
<li><a href="http://github.com/channelCS">Github</a></li>
<li><a href="http://github.com/Deeplearn-lab">Deeplearn-lab</a></li>
</ul>
</div>
</div>
</div> </div>
<footer>
<br />
<p><a href="">channelCS</a> © channelCS 2018</p>
</footer>
</div> <!-- /container -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="/theme/bootstrap-collapse.js"></script>
</body>
</html>