有没有办法找到使用git blame
在repo中编辑java文件中的类的作者列表?作者列表必须是唯一的。
我已尝试使用以下命令,但它没有删除重复项,并且有单词" author"在每一行输出中。没有必要对输出进行排序,但我希望得到的输出没有任何重复。
git blame filename --porcelain | grep "^author "
预期输出应该只是作者姓名:John Michael
答案 0 :(得分:6)
您可以在命令git blame filename --porcelain | grep "^author " | uniq
的末尾添加以使作者独一无二。
def input_students
puts "Please enter the names and hobbies of the students plus country of birth"
puts "To finish, just hit return three times"
#create the empty array
students = []
hobbies = []
country = []
cohort = []
# Get the first name
name = gets.chomp
hobbies = gets.chomp
country = gets.chomp
cohort = gets.chomp
while !name.empty? && !hobbies.empty? && !country.empty? && cohort.fetch(:cohort, january) do #This is to do with entering twice
students << {name: name, hobbies: hobbies, country: country, cohort: cohort} #import part of the code.
puts "Now we have #{students.count} students"
# get another name from the user
name = gets.chomp
hobbies = gets.chomp
country = gets.chomp
cohort = gets.chomp
end
students
end