It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Latest modified components

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 Feb 09, 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 

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 Feb 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!

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 Feb 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!

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 Feb 12, 2019

In that case you could try 

git log --name-only

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Off-topic

Do you still play the same games you played when you were a kid?

Months ago, I was walking in a huge grocery store and I went to the toys aisle and found a jigsaw puzzle that was more than 50% off, and I thought "why not? It will be fun and it can be a beautiful f...

315 views 35 12
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you