Latest modified components

Prakash February 7, 2019

How to get all the components changed as part of last commit. If I download manually the latest commit it downloads everything from the branch. But my requirement is to get only components that changed during last commit.

1 answer

0 votes
Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 9, 2019

Hi Prakash,

can you explain more about what you mean by 'download manually the latest commit' ?

Are you using the git pull command in your terminal on your machine?

The power of git - and what makes it different to other version control systems such as subversion - is that it does store the entire repository on your machine.  

If you are interested in the inner workings of git, I can highly recommend this guide: https://www.atlassian.com/git 

Prakash February 10, 2019

Hi Martyn,

Thanks for going though my question. As mentioned I would like to elaborate my requirements. Let's say I have added two new components (c1 and c2) to my repository and did the commit. So when I look at the commit I could see that c1 and c2 are added to the repository. Now my requirement is to get only these 2 components which are added newly to the repository via git commands, Hope this is more clearer. 

Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 10, 2019

I think I understand what you're trying to do.

Let's say you have a branch called my-branch where you have added the commit and the commit hash is d9063641 (this is made up).

The components are within the repository at the path path/to/components/one and path/to/components/two.

Some options to try:

  1. git checkout my-branch path/to/components/one followed by git checkout master path/to/component/two
  2. git checkout my-branch d9063641

 

I hope that helps!

Prakash February 11, 2019

Sorry Martyn, I am still not clear. I am giving an example as below.

Let's say I had file1, file2, file3 in a branch  called My_branch. That mean this branch is copied from master and master had already these 3 files. Now I have added file4 and file5 to My_branch as part of commit d9063641 (this is made up). That means now My_branch contains all five files. Here the delta changes are file4 and file5. I would like to get only changed components i.e. file4 and file5 from the branch. How can I achieve this with git commands

Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 11, 2019

Hi Prakash,

Can you please explain what you mean by "I would like to get only changed components i.e. file4 and file5 from the branch".  You already have my_branch on your machine.  

Would you like to:

A) Get this commit on to master?

If so, typically you could create a pull request for this, but we can discuss this more if this is your use case.

B) Get a list of what has changed in commit d9063641?

If so, the following commands will show you what changed between the previous commit and this commit

git diff d9063641~ d9063641
git show d9063641

 

I hope that helps!

Prakash February 11, 2019

Hi Martyn,

Yes, I want to see what are the components (only name not in detail level) changed as part of current commit over last commit. That means difference should return only the names i.e. file4 and file5 rather what changes done inside the components. 

Like Marty likes this
Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2019

In that case you could try 

git log --name-only

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events