Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git pull one file from remote

Tags:

git

git-pull

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:

  1. pulling the original "task.js" from the remote "master" branch to the local "Li" branch
  2. 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

like image 286
user429400 Avatar asked Dec 31 '25 03:12

user429400


1 Answers

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.

like image 129
weynhamz Avatar answered Jan 02 '26 15:01

weynhamz