in Education by
How do I discard changes in my working copy that are not in the index? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
You can discard unstaged changes in git using the following commands For added or modified file that is not staged we use the following For all unstaged files in the working directory $git checkout -- .(. For all files) $ git checkout -- (for a specific file to be discarded) or you can use $git stash Then if you need to discard the untracked you can use $git clean -i here -i mean interactive mode then it will open like this There are options for you and you can select your option, clean will be used to discard the untracked file in git. For better understanding about these commands go through the following crash course on git that will help you to understand git well

Related questions

0 votes
    I used git pull and had a merge conflict: unmerged: _widget.html.erb You are in the middle of a conflicted merge. ... can I do this? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I've been using Git for a while now and have recently downloaded an update only to find this warning message ... share repos with? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have made some changes to a file that has been committed a few times as part of a group of files, but ... former state in the past Select the correct answer from above options...
asked Jan 31, 2022 in Education by JackTerrance
0 votes
    How can we discard unstaged changes in Git?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    My git workspace is dirty, there are some local modifications. When I use the command git pull origin master it ... Ansible git module? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    How can we make ignore file mode (chmod) changes in git?...
asked Jan 8, 2021 by JackTerrance
0 votes
    I staged a few changes to be committed; how can I see the diff of all files which are staged for the next ... an alias for, right? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I staged a few changes to be committed; how can I see the diff of all files which are staged for the next ... an alias for, right? Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I would prefer to write my commit messages in Vim, but it is opening them in Emacs. How do I configure Git ... for a single project. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    How do I revert from my current state to a snapshot made on a certain commit? If I do git log, then I get ... , i.e. commit 0d1d7fc? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I don't want to rename a remote branch, as described in the Rename master branch for both local and remote ... and remote branch name Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I want to take all the changes I made in the staging to my working directory. What command should I use to perform this ... B. git reset HEAD C. git reset TAIL D. git change...
asked Dec 23, 2022 in Technology by JackTerrance
0 votes
    I created a local branch that I want to 'push' upstream. There is a similar question here on Stack ... the upstream repository? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I pulled a project from GitHub a few days ago. I've since discovered that there are several forks on GitHub, ... those forks I pulled? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    What does the command git reset –hard HEAD ~3 do? A. Merges the last 3 commits to the master B. Discards ... nothing D. Resets the head to 3 commits before the current commit...
asked Dec 23, 2022 in Technology by JackTerrance
...