git pull one file from remote
10,697
git reset HEAD~
will revert the laster commit of the current branch, but since you have already pushed the branch Li to public, it is better to do a git checkout master task.js
and commit again in your branch Li.
Related videos on Youtube
Author by
user429400
Updated on October 18, 2022Comments
-
user429400 over 1 year
I've cloned a repository "Rep" and created my own local branch "Li". I've committed a file called "task.js" to the local "Li" branch and pushed it to the remote "Li" branch. Now I want to revert this action by:
- pulling the original "task.js" from the remote "master" branch to the local "Li" branch
- push the reverted "task.js" from the local "Li" branch to the remote "Li" branch.
I tried to read several "pull" tutorials but can't figure out a way to do this (maybe because I don't really understand the basics yet...)
Thanks, Li
-
weynhamz over 11 yearsDue to he his already pushed the Li branch which means this is probably not a good idea.
-
user429400 over 11 yearswhat does this command do? Does this overrides the local "Li" task.js with the local master task.js? (it worked, I just want to understand what I did)
-
weynhamz over 11 yearsYes,
git checkout master task.js
will simply checkout the task.js of the master branch, for your case, you probably need a-f
flag. -
Mohanraj over 11 yearsOh, ok, so he need to revert that commit.