Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out in which commit a particular code was added?

Tags:

git

git-commit

I want to find out in which commit did I add the code given below:

if (getListView().getChildCount() == 0)                 getActivity().findViewById(android.R.id.empty).setVisibility(View.VISIBLE); 

How do I achieve this?

like image 941
Harshal Kshatriya Avatar asked Nov 09 '13 10:11

Harshal Kshatriya


People also ask

How do you find which branch a commit belongs to?

It is based on "Find merge commit which include a specific commit". Find when a commit was merged into one or more branches. Find the merge commit that brought COMMIT into the specified BRANCH(es). Specifically, look for the oldest commit on the first-parent history of BRANCH that contains the COMMIT as an ancestor.

How do I find a specific commit change?

Looking up changes for a specific commit If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .

How do you check details of a commit?

`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.


1 Answers

git log -S searchTerm 

gives you the commits in which the search term was introduced.

like image 179
Rahil Ahmad Avatar answered Sep 28 '22 09:09

Rahil Ahmad